i have the following shell script-
#!/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
I am executing in following way -
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'
there is a php_test.php in the same directory as the present one. PLease help. Thanks in advance.
Ignacio Vazquez-Abrams
803k160 gold badges1.4k silver badges1.4k bronze badges
asked Jan 10, 2011 at 9:11
1 Answer 1
From help while
:
while: while COMMANDS; do COMMANDS; done
You're missing the do
.
while true
do
...
done
answered Jan 10, 2011 at 9:15
Ignacio Vazquez-Abrams Ignacio Vazquez-Abrams
803k160 gold badges1.4k silver badges1.4k bronze badges
Comments
lang-bash
$path
with double quotes to prevent spaces in the variable to have bash consider it as two arguments after expansion.