shell脚本中意外令牌错误附近的语法错误

时间:2011-01-10 09:11:04

标签: bash

我有以下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。请帮忙。提前谢谢。

1 个答案:

答案 0 :(得分:4)

来自help while

while: while COMMANDS; do COMMANDS; done

您错过了do

while true
do
 ...
done