This is the easiest way to check if the last command was succesful in bash. [raw] your_command_to_test if [ $? -eq 0 ]; then echo OK else echo FAIL fi [/raw]