ayush
ayush

Reputation: 14568

syntax error near unexpected token error in shell script

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.

Upvotes: 2

Views: 3022

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798536

From help while:

while: while COMMANDS; do COMMANDS; done

You're missing the do.

while true
do
 ...
done

Upvotes: 4

Related Questions