How to exit if a command failed? [duplicate]
This question already has answers here: Aborting a shell script if any command returns a non-zero value (10 answers) Closed last year. I am a noob in shell-scripting. I want to print a message and exit my script if a command fails. I’ve tried: my_command && (echo ‘my_command failed; exit) but it does not work. … Read more