Checking the exit status of commands