Shell 第 7 行:[14:找不到命令 [英] Shell line 7: [14: command not found

查看:64
本文介绍了Shell 第 7 行:[14:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道要解决什么问题这里是代码:

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

请帮忙!

推荐答案

[ 之后] 之前必须加空格:

You have to add blanks after [ and before ]:

if [ $HOUR -gt $TARGET ];

这篇关于Shell 第 7 行:[14:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆