check exit status of each command