我在bash
以下代码:猛砸附近意外的标记`/语法错误}”
check_port()
{
local host=${1}
local port=${2}
echo $host
echo $port
while true; do
if nc -w 5 -z 127.0.0.1 111 && nc -w 5 -z 127.0.0.1 5001 ;
then
echo -e "\a\n => Port at host is open"
break
else
echo -e "\a\n => Port at host is closed"
break
fi
}
出于某种原因,我得到以下错误:
syntax error near unexpected token `}'
`}'
我不明白原因:}
正在关闭该功能的范围。
仰望'while'循环的语法将教你什么是错的脚本。 – user2719058 2014-08-31 19:34:55