我有以下shell脚本 -
#!/bin/bash
echo "enter the full path of script";
read path;
while true
ps aux | grep -v grep | grep -q $path || ( nohup php -f $path & )
done
我正按以下方式执行 -
bash test.sh
enter the full path of script
php_test.php
test.sh: line 7: syntax error near unexpected token `done'
test.sh: line 7: `done'
在与当前目录相同的目录中有一个php_test.php。请帮忙。提前谢谢。
答案 0 :(得分:4)
来自help while
:
while: while COMMANDS; do COMMANDS; done
您错过了do
。
while true
do
...
done