How to find the return value of last executed command in UNIX?
You can use the shell variable $?
$?
Such as:
$ true ; echo $? 0 $ false ; echo $? 1