Bash Conditional Expressions Test on exit status of a command


Example

Exit status 0: success
Exit status other than 0: failure

To test on the exit status of a command:

if command;then
    echo 'success'
else
    echo 'failure'
fi