I'm running Terminal Version 2.6.1 on Mac. I'm writing a bash script, and I want to exit the script if a certain condition is met.
I do that with this command:
exit 1
after doing that, the script exits and I see this on the terminal:
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
After that, my terminal is frozen and I can't do anything with it anymore.
Is there a way to negate having to open up a new terminal each time the script quits?
I am running the script from my terminal like this:
. script.sh
quitcommand at all. I'd be curious as to whattype quitreturns for you. (As the existing answer says, the proper way to cause the shell running a script to quit isexit).. yourscriptorsource yourscript, then the script is being run by your main interpreter, so exiting it exits the terminal.exec yourscriptwill similarly replace your interactive shell with the one running the script, so when the script exits you have nothing left.. script.sh? There are reasons to do that, but it's atypical, and is generally the wrong thing to do.