>_ linuxcommand.dev
Shell

$?

Exit status of the most recently executed command.

Syntax
$echo $?
Examples
Examples
$ls /tmp && echo $?
Examples
$false; echo $?
Typical use cases
Check command result in scripts
command; if [ $? -ne 0 ]; then ... fi
Note 0 means success, non-zero indicates an error condition.
Export