This question already has an answer here:
- Why does ( exit 1 ) not exit the script? 4 answers
I have a script with the following code:
command_that_could_fail || (echo "command failed"; exit 1)
However, the exit seems to just be exiting from the sub-command formed by the second part of the line (in parentheses), not from the script itself. Any way that I can make it behave as desired, and exit from the outer script?