sajad torkamani

$? gives you the exit code for the last command.

Tagged: Bash