Any way to "exit" a multi step script before a subsequent step executes?

In a multi-step script, I (might) want to do something like:


# step 1


# gather a bunch of information


# if I _don"t_ find X information


# exit this .ind script entirely, do not go on to step 2


# else, continue to step 2



Is this possible?

Hmm, this is possible if first step is parsed using the AWK parser. In that case, simply instruct the parser to generate the dynamic variables only if the information is found. This way, only relevant dynamic variables with the appropriate information will be generated, and the second step will run only for those.


Alas, if the first step is parsed with XML/JSON, this isn't quite possible (at least not at the moment).

Depending on how the data looks like you could potentially also add a condition to the Json/X-Path query in the first step.

https://askubuntu.com/questions/439732/how-can-i-process-multi-line-records-with-awk-in-a-bash-script

Regex Matching with python os.system module should help to decide on the conditional part of the program.

Would this be just terminate the running instance of the script or is there more to it ?