您好我正在尝试安装一个相当冗长的脚本来安装infiniband和OFED堆栈在rock cluster 6.0上
这是我尝试运行的内容
user@cluster # /etc/init.d/openibd restart
/etc/init.d/openibd: line 147: syntax error near unexpected token `;&'
/etc/init.d/openibd: line 147: `if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then'
任何人都可以与我分享修复程序或者可以找到修复此脚本中错误的方法吗? 在文件/etc/init.d/openibd
中这是脚本中包含指示行错误的部分。
CONFIG="/etc/infiniband/openib.conf"
if [ ! -f $CONFIG ]; then
echo No InfiniBand configuration found
exit 0
fi
. $CONFIG
CWD=`pwd`
cd /etc/infiniband
WD=`pwd`
PATH=$PATH:/sbin:/usr/bin
if [ -e /etc/profile.d/ofed.sh ]; then
. /etc/profile.d/ofed.sh
fi
# Only use ONBOOT option if called by a runlevel directory.
# Therefore determine the base, follow a runlevel link name ...
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
# ... and compare them
if [ $link == $base ] ; then
RUNMODE=manual
ONBOOT=yes
else
RUNMODE=auto
fi
ACTION=$1
shift
RESTART=0
max_ports_num_in_hca=0
# Check if OpenIB configured to start automatically
if [ "X${ONBOOT}" != "Xyes" ]; then
exit 0
fi
### ERROR ON FOLLOWING LINE ###
if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then
if [ -n "$INIT_VERSION" ] ; then
# MODE=onboot
if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ${CONFIG} > /dev/null
; then
exit 0
fi
fi
fi
答案 0 :(得分:2)
你需要修复一些HTML编码。
将>
替换为>
,并将&
替换为&
。
答案 1 :(得分:1)
你的脚本以某种方式拥有了它的所有>替换为>
(以及&替换为&
等)
if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then
^^
这是一个语法错误,因为在结束前面命令的分号和&符号之间没有命令。某些符号的HTML编码会使bash解析器混淆。