I have the above shell script .
#!/bin/bash
# a shell script that keeps looping until an exit code is given
nice php -q -f ./data.php -- $@
ERR=$?
exec $0 $@
I have a few doubts
$0 and what is $@ERR=$? -- $@ in 5th line do 1) $0 is the name of the executable (the script in your case, eg: if your script is called start_me then $0 is start_me)
2) ERR=$? gets the return code of nice php -q -f ./data.php -- $@
3) -- $@ does two things, first of all it tell the php command that all following parameter shall be passed to data.php and $@ passes all given parameter to the script to ./data.php (eg. ./your_script_name foo bar will translate to nice php -q -f ./data.php -- foo bar)
4) short answer yes, but you have to change the script to
YOUR_FILE=$1
shift #this removes the first argument from $@
nice php -q -f ./$YOUR_FILE -- $@
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With