Bash脚本有条件地执行while循环

时间:2020-03-25 17:56:07

标签: bash shell

我在用while语句中的2个条件做do while循环语法时很挣扎:

while [[ supervisorctl status | grep $1 | awk '{print $2}' != 'RUNNING' ]] && [[ $count -gt 0 ]]; do
       supervisorctl start $1
       sleep 3
       $count=$count -1
done

当我在脚本上运行bash -n以检查语法错误时,我得到以下输出:

line 31: conditional binary operator expected
line 31: syntax error near `status'
line 31: `        while [[ supervisorctl status | grep $1 | awk '{print $2}' != 'RUNNING' ]] && [[ $count -gt 0 ]]; do'

有人可以帮助我确定正确的语法吗?

0 个答案:

没有答案
相关问题