我收到以下代码的错误“语法错误:文件的意外结束”

时间:2016-12-02 12:46:44

标签: shell scripting

export JAVA_HOME=/usr/java/jdk1.5.0_22
export PATH=$JAVA_HOME/bin:$PATH
CHECK=`/opt/OV/TNT/adapter/bin/temip_adapter_show | grep "The Adapter is initialized and ready" | wc -l`
if [$CHECK -ne 0]
then
echo "Atni adapter is already running, Please check"
else
/opt/OV/TNT/adapter/bin/temip_adapter -start
fi
mailx -s "NNMi Atni Adapter status" -r srijan.chaudhary@hpe.com <<-EOF

Hi Team,

NNMi Atni适配器已成功启动

的问候,
NNM服务器
EOF

2 个答案:

答案 0 :(得分:0)

在[和之前]之后添加空格,如下所示;你可以试试这个;

export JAVA_HOME=/usr/java/jdk1.5.0_22
export PATH=$JAVA_HOME/bin:$PATH
CHECK=`/opt/OV/TNT/adapter/bin/temip_adapter_show | grep "The Adapter is initialized and ready" | wc -l`
if [ $CHECK -ne 0 ]
then
echo "Atni adapter is already running, Please check"
else
/opt/OV/TNT/adapter/bin/temip_adapter -start
fi
echo "NNMi Atni Adapter status" | mailx -s "NNMi Atni Adapter status" srijan.chaudhary@hpe.com

答案 1 :(得分:0)

编辑最后一行: mailx -s“TeMIP服务器已成功启动”srijan.chaudhary@hpe.com - -f srijan.chaudhary@hpe.com<&lt; -EOF

并清除脚本中的所有特殊字符。