Feb 022010
Check the exit status of a command
Answer:
You can check the exit status of a command by checking the special variable $?
E.g.
# ls
# echo $?
0
# foo
-bash: foo: command not found
# echo $?
127
Non zero (e.g. 127) exit status mean the command failed to execute.