The exit command is used to terminate the current shell. It is a built-in command, so it is available in all types of shells, such as Bash, Zsh, C shell, and more.
The basic syntax of the exit command is as follows:
exit [N].
Here, "N" is an integer. The default return value is 0, indicating a successful shell exit. For example, executing exit 0 signifies a successful exit.
$ bash $ cp -r folder1/ folder2/ $ exit $ echo $0 ← Check the return value of the previous command |
For examples and usage, refer to the provided link.