Hi I am trying to install a fairly lengthy script to install infiniband and the OFED stack on rocks cluster 6.0
你好,我正在安装一个相当长的脚本安装infiniband和OFED堆栈在rocks cluster 6.0上
here is what i try to run
这是我要跑的
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'
can any one share with me a fix or can identify a way to fix the error in this script? in the file /etc/init.d/openibd
有没有人能和我分享一个修正或者找出一个修正这个脚本错误的方法?在文件/etc/init.d/openibd
here is the part of the script which contains the error on the indicated line.
这是脚本的一部分,它包含指定行上的错误。
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
2 个解决方案
#1
2
You've got some HTML encoding going on their you need to fix.
你需要修正一些HTML编码。
Replace >
with >
, and replace &
with &
.
取代的在用>替换&&。
#2
1
Your script somehow had all of its > replaced with >
(and & replaced by &
, etc)
您的脚本以某种方式将所有的>替换为>(及被& & &等取代)
if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then
^^
This is a syntax error because there is no command between the semi-colon that terminates the preceding command and the ampersand. The HTML encoding of certain symbols is confusing the bash parser as a result.
这是一个语法错误,因为终止前面命令的分号和&号之间没有命令。某些符号的HTML编码导致bash解析器混乱。
#1
2
You've got some HTML encoding going on their you need to fix.
你需要修正一些HTML编码。
Replace >
with >
, and replace &
with &
.
取代的在用>替换&&。
#2
1
Your script somehow had all of its > replaced with >
(and & replaced by &
, etc)
您的脚本以某种方式将所有的>替换为>(及被& & &等取代)
if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then
^^
This is a syntax error because there is no command between the semi-colon that terminates the preceding command and the ampersand. The HTML encoding of certain symbols is confusing the bash parser as a result.
这是一个语法错误,因为终止前面命令的分号和&号之间没有命令。某些符号的HTML编码导致bash解析器混乱。