, , , .
if your_command; then ...
,
your_command
if [ "$?" -eq 0 ]; then ...
, : echo , $? , , , your_command .
:
your_command
echo "Finished running your_command" >&2
if [ "$?" -eq 0 ]; then ...
... , .
, , , , , :
your_command; your_command_retval=$?
echo "Finished running your_command" >&2
case $your_command_retval in
0|2) echo "your_command exited in an acceptable way" >&2;;
*) echo "your_command exited in an unacceptable way" >&2;;
esac
: your_command if, , set -e ERR.
:
set -e
your_command
if [ "$?" -eq 0 ]; then ...
... ( , set -e) if $? 0, set -e . :
set -e
if your_command; then ...
... your_command set -e.