如果我从这个错误中启动脚本:
./Sinusbot.sh: line 276: unexpected EOF while looking for matching `)'
./Sinusbot.sh: line 305: syntax error: unexpected end of file
受影响的脚本的一部分:
echo -e "$info Configuring instances"
if [ "$ydl" = "y" ] || [ "$ydl" = "Y" ]; then
c2="0"
while [ $c2 = $nbot ]
do
c2=$((c2+1) #Line 276
bport=$((bport+1)
cd
cd Sinus-$2
cat > config.ini << EOL
ListenPort = ${bport}
ListenHost = "0.0.0.0"
TS3Path = "TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64"
YoutubeDLPath = "youtube-dl"
DataDir = "data/"
EOL
done
else
while [ $c2 = $nbot ]
do
c2=$((c2+1)
bport=$((bport+1)
cd
cd Sinus-$2
cat > config.ini << EOL
ListenPort = ${bport}
ListenHost = "0.0.0.0"
TS3Path = "TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64"
DataDir = "data/"
EOL
done
fi
#line 305
为什么会发生这种情况,我该如何解决?
除了notepad ++之外,所有的行都显示为蓝色,因为我把“cat”config.ini&lt;&lt; EOL“怎么样?我怎么能脱掉它?
答案 0 :(得分:1)
这些行有两个起始括号,但只有一个结束括号:
c2=$((c2+1)
bport=$((bport+1)
考虑到程序的缩进,您可能希望通过在每行添加右括号顶部来关闭它们:
c2=$((c2+1))
bport=$((bport+1))