$?
Exit status of the most recently executed command.
Syntax
$echo $?
Examples
Examples
$ls /tmp && echo $?
Examples
$false; echo $?
Typical use cases
command; if [ $? -ne 0 ]; then ... fi
Note
0 means success, non-zero indicates an error condition.
Export