I am trying to make a "toolkit", and what I want is for it to have an "exit" functionality. Meaning that whenever I invoke "exit", whatever I have started should stop. However, not just the toolkit script, but the main script as well. Meaning the following:
Let A.sh be the master script. At some point, A.sh will trigger B.sh, which gives the user options. I want B.sh to always have an "exit" option. When chosen, it should exit B.sh (easy, just run "exit"), but also end A.sh.
Of course, I could do something like
if [[ $(B.sh) == "exit" ]]; then exit; fi
but that is tedious at best, and generally not what a "toolkit" should do.
Any ideas how I can do it? Cheers.