|
How to automatically detect command failure
I have a shell script. In this script I executes various command and my requirement is such that if any command fails I've to terminate the shell script.
To achieve this objective I'm checking the value of $? after each command and if its value is greater thaen I 'exit' the script.
Is there any way through which I can avoid the if condition on $? after each and every command as It a pain to put if condition after every command.
|