Shell line 7: [14: command not found [duplicate]

百般思念 提交于 2019-12-20 07:49:32

问题


I don't know what is the problem to fix Here is the code:

#!/bin/sh
while true
do
HOUR=$(date '+%H')
TARGET=16
echo $HOUR
if [$HOUR -gt $TARGET];
then
mail -s "IP" "example@hotmail.com" <<EOF
Global_IP=$(curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
EOF
echo "Sent"
fi
echo "Waiting..."
sleep 3600
echo "Done waiting"
done

Please help!


回答1:


You have to add blanks after [ and before ]:

if [ $HOUR -gt $TARGET ];


来源:https://stackoverflow.com/questions/34809142/shell-line-7-14-command-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!