首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >/etc/init.d/openibd:第147行:意外标记`;&‘附近出现语法错误

/etc/init.d/openibd:第147行:意外标记`;&‘附近出现语法错误
EN

Stack Overflow用户
提问于 2012-05-17 02:46:49
回答 2查看 1.6K关注 0票数 0

您好,我正在尝试安装一个相当长的脚本来安装infiniband和OFED堆栈上的岩石集群6.0

下面是我尝试运行的内容

代码语言:javascript
复制
 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中

这是脚本的一部分,其中包含指示行上的错误。

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-05-17 02:52:18

你需要修复他们的一些HTML编码。

>替换为>,将&替换为&

票数 2
EN

Stack Overflow用户

发布于 2012-05-17 02:52:18

您的脚本以某种方式将其所有>替换为> (并替换为&,等等)

代码语言:javascript
复制
if ( grep -i 'SuSE Linux' /etc/issue >/dev/null 2>&1 ); then

                                                       ^^

这是一个语法错误,因为在终止前面命令的分号和与号之间没有命令。因此,某些符号的HTML编码会使bash解析器感到困惑。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10624737

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档