小编214*_*647的帖子

为什么 bash 脚本会产生错误“命令未找到”?

这个脚本中的第五行有什么问题(我已经包含了给我错误的代码片段,实际的错误列在代码后面的底部和完成脚本的链接)?

#! /bin/bash
INSTALLDIR=/usr/local/mapguideopensource
CLEAN_FLAG=0
while [ $# -gt 0 ]; do    # Until you run out of parameters...
  case "$1" in
    -prefix|--prefix)
        INSTALLDIR="$2"
        shift
        ;;
    -clean|--clean)
        CLEAN_FLAG=1
        shift
        ;;
    -help|--help)
        echo "Usage: $0 (options)"
        echo "Options:"
        echo "  --prefix [installation directory]"
        echo "  --clean [clean all objects and binaries in Oem]"
        echo "  --help [Display usage]"
        exit
        ;;
esac
shift   # Check next set of parameters.
done
Run Code Online (Sandbox Code Playgroud)

这是我在 Linux (REHL5) 上运行这个 bash 脚本时遇到的错误:

: command not founde 4:  
: …
Run Code Online (Sandbox Code Playgroud)

bash shell

0
推荐指数
1
解决办法
1238
查看次数

标签 统计

bash ×1

shell ×1