2012-09-10 5 views
1

이것은 매우 간단해야하지만 불만 사항에 대해서는 확신 할 수 없습니다.Solaris에서 Linux로 쉘 스크립트 포팅

type=${1-"-Debug"}; 
version=${2-"-0"}; 
echo "We are going to be building eValuate in build mode: " $type 
if [[ $version = -1 ]] 
    then 
    echo "We are going to be building eValuate with omniORB-4.1.4" 
    else 
    echo "We are going to be building eValuate with omniORB-4.0.4" 
fi 
if [ $PLATFORM = "HPUX" ] 
then 
    if [ $type = -release ] 
    then 
     export MAKEFILE_MAIN=$PWD/common/makefile/makefile.hp 
     export MAKEFILE_DEFS=$PWD/common/makefile/makefile.hp.rls 
     shift 
    else 
     export MAKEFILE_MAIN=$PWD/common/makefile/makefile.hp 
     export MAKEFILE_DEFS=$MAKEFILE_MAIN 
    fi 

    elif [ $PLATFORM = "AIX" ] 
    then 
     mv $PWD/Calculations/CalculationSTD/makefileAIX $PWD/Calculations/CalculationSTD/makefile 
     mv $PWD/Calculations/CalculationSTD/StandardCalculationAIX.cpp  $PWD/Calculations/CalculationSTD/StandardCalculation.cpp 
     rm -r $PWD/Calculations/CalculationSTD/Carleton 
     if [ $type = -release ] 
     then 
     export MAKEFILE_MAIN=$PWD/common/makefile/makefile.aix 
     export MAKEFILE_DEFS=$PWD/common/makefile/makefile.aix.rls 
     shift 
     else 
    export MAKEFILE_MAIN=$PWD/common/makefile/makefile.aix 
    export MAKEFILE_DEFS=$MAKEFILE_MAIN 
     fi 
    fi 

이것은 Solaris 및 AIX에서 잘 작동하는 것 같다,하지만 리눅스에서,이 오류 메시지를 얻을 :

: command not found 1: 
    : command not found 2: 
    We are going to be building eValuate in build mode: -release 
    ./setpath.sh1: line 22: syntax error near unexpected token `elif' 
    '/setpath.sh1: line 22: `  elif [ $PLATFORM = "AIX" ] 

이유는 ELIF를 좋아하지 않습니다? 아니면 다른 것에 대해 불평하고 있습니까?

+0

스크립트에 적절한 줄 바꿈이 있습니까? 그렇지 않다면, 처음에'#!/bin/sh'를 추가하는 것이 도움이됩니까? (구문이 Bourne 쉘이 아니지만, #!/bin/bash' 스크립트로 명시 적으로 선언해야합니다.) – tripleee

+0

bash, sh, ksh 프롬프트에서 스크립트를 실행했지만 여전히 동일한 결과를 얻었습니다 오류 – roymustang86

+0

"elif [$ PLATFORM ="AIX "]"(단일 괄호) – dimba

답변

1

마침내 대답을 얻었다, 완전히 무작위 뭔가 형식 함께 할 수있는 뭔가 덕분에 : 내 윈도우 머신에서 이상 파일을 전송했다

, 나는 리눅스가 할 수없는 단지 나쁜 것 같다 처리해. 솔라리스와 AIX는 괜찮습니다.

이 명령을 사용하십시오. dos2unix * .sh