In a Bash script, how can I exit the entire script if a certain condition occurs?

I’m writing a script in Bash to test some code. However, it seems silly to run the tests if compiling the code fails in the first place, in which case I’ll just abort the tests.

Is there a way I can do this without wrapping the entire script inside of a while loop and using breaks? Something like a dun dun dun goto?

8 s
8

Leave a Comment