Exit from a script

Calling exit will stop the running of the script and set the exit status to 0. Calling exit N with any number of N will set the exit status to that N.

exit   - on the command line to close the window (or the most recent shell)
exit   - in a script to end the script (exit code = most recent statement)
exit n - exit code n