Shell line 7:[14:命令未找到

时间:2016-01-15 10:34:52

标签: shell terminal sh

我不知道修复了什么问题以下是代码:

#!/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

请帮忙!

1 个答案:

答案 0 :(得分:0)

您必须在[之后和]之前添加空白:

if [ $HOUR -gt $TARGET ];