在执行shell脚本时,我收到了错误“接近意外令牌‘I’的语法错误”。
有人能帮我找出我在句法上是否犯了什么错误吗?
if [ date "+%b %d" == ls -lrt start.log | tr -s " " | cut -d" " -f6-7 ] &&
[ date "+%k" == ls -lrt start.log | tr -s " " | cut -d" " -f8 | cut -c1-2 ] &&
[ ls -lrt start.log | tr -s " " | cut -d" " -f8 | cut -c4-5 >= date -d "now 15 minutes ago" "+%M" ]; then发布于 2014-04-26 03:59:10
您需要使用命令替换来捕获命令的输出,以便进行比较。
if [ $(date "+%b %d") = $(ls -lrt start.log | tr -s " " | cut -d" " -f6-7) ] &&
# etc.https://stackoverflow.com/questions/23306443
复制相似问题