In this short article, we would like to show some concept that lets you break Bash script when some command inside returns error.
Assumption: in the below example as error, we understand status different than
0returned from some program/command.
#!/bin/bash command_1 || exit 1 command_2 || exit 1 if ! command_3 then echo "Some error detected!"; exit 1 fi exit 0
Hint: for commands errors you can return different numbers than