linux - 将 shell 脚本从 Solaris 移植到 Linux

标签 linux shell solaris rhel5

这应该非常简单,但我不确定它在提示什么。

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 上运行良好,但在 Linux 上,我收到以下错误消息:

   : 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?或者,它是否在提示其他事情?

最佳答案

终于找到答案了,完全是随机的,跟格式有关:

我已经从我的 windows 机器上传输了文件,我猜 Linux 只是一个无法处理它的婊子。 Solaris 和 AIX 做得很好。

使用了这个命令。 dos2unix *.sh

关于linux - 将 shell 脚本从 Solaris 移植到 Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12358040/

相关文章:

linux - shell 脚本和 makefile 的命名约定

c - 运行 C 程序备份 Linux 文件

linux - 如何使用 set 设置 shell 函数的复杂参数

linux - 如何在 USB 大容量存储模式下通过手机列出连接到 Linux 的 SD 卡的内容?

c - 内核导出符号与全局符号与静态全局符号?

c - 如何调试内存随机变化问题

c - 在 Oracle Solaris 11 上获取进程列表

c++ - Solaris 10 CC 预处理器错误导致 undefined symbol

linux - 为什么 volumio.local 能够访问树莓派,因为它连接到本地网络

编译器使用局部变量而不调整 RSP