Here is the problem
bash-2.05# cat test1.sh
ATM_PIN="123"
echo "Environment variables" > out.log
env >> out.log
echo $ATM_PIN
bash-2.05# sh test1.sh
123
bash-2.05# cat out.log |grep -i atm
bash-2.05#
While debugging a shell script, if the values of the variables are required in an intermittent state of the shell script execution use the -a option.
bash-2.05# sh -a test1.sh
123
bash-2.05# cat out.log |grep -i atm
ATM_PIN=123
bash-2.05#
Wednesday, May 30, 2007
Subscribe to:
Post Comments (Atom)
3 comments:
Actually I am looking out for a complete shell script debugger , like gdb is for C.
Found http://bashdb.sourceforge.net/bashdb.htm
I have not evaluated the product yet... please let me know if one has used it .
hey, abt the post... i was wondering something is not right... then i read thru man-pages of sh.. -a is actually
"-a Automatically export subsequently defined parameters."
so there you go.
instead, just cultivate the habit of exporting all variables in case you need the variable across shells. or source it for future invocations...
Post a Comment