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

Bash shell脚本中出现意外令牌错误附近的语法错误,bash,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: sy

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

来自
帮助,而

您缺少
do

while true
do
 ...
done

这个问题与PHP无关,也可以用双引号逃出<代码> $PATH < /COD>,以防止变量中的空格有BASH,在扩展后将其视为两个参数。
while true
do
 ...
done