If you want to check each command for error codes, then no I would think you would need to check the value of $? for each command.
If you want the fourth command to run only if the previous three ran succesfully you could try:
command1&&command2&&command3&&command4
command2 would only run if command1 was successful.
command3 would only run if command2 was successful.
command4 would only run if command3 was successful.
if $? is 0 then all commands were successful, otherwise one failed but you have no way (that I know of) to determine which command failed.
|