Kolam Ayer MakersLinux Foundations

Command: exit

Use

exit
exit 1

What It Does

exit ends the current shell or script and returns an exit status to its parent process.

In an interactive remote shell, ending the shell also ends that login session. That is a consequence of the shell exiting, not an SSH-specific feature of exit.

Scripts

if [[ "$#" -lt 1 ]]; then
  printf 'usage: %s NAME\n' "$0" >&2
  exit 1
fi

Use 0 for success and nonzero values for failure.

Docs Pointers