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
- What is
$0and what is$@ - what is
ERR=$? - what does
-- $@in 5th line do - I wanted to know if can i pass data.php as a parameter. so that i have only i shell script for all kind of execution . Say, i want to run “sh ss.sh data1.php” then this should run data1.php, if run “ss ss.sh data2.php” it should run data2.php –
1)
$0is the name of the executable (the script in your case, eg: if your script is calledstart_methen$0isstart_me)2)
ERR=$?gets the return code ofnice php -q -f ./data.php -- $@3)
-- $@does two things, first of all it tell thephpcommand that all following parameter shall be passed todata.phpand$@passes all given parameter to the script to./data.php(eg../your_script_name foo barwill translate tonice php -q -f ./data.php -- foo bar)4) short answer yes, but you have to change the script to