exit command

 

The exit command to exit the current shell, the shell script can terminate the current script execution.

Common parameters
Format: exit n
exit. Set exit code to n. (Cause the shell to exit with a status of n.)

Format: exit
quit. Exit code unchanged, exit code is the last command. (If n is omitted, the exit status is that of the last command executed.)

Format: $?
Exit code on a command.

Format: Trap "Commands" EXIT
Commands specified command execution when exiting. (A trap on EXIT is executed before the shell terminates.)

Exit code (exit status, or exit code) of the convention:
0 for success (Zero - Success)
is non-zero for failure (Non-Zero - Failure)
2 represents inappropriately (in here Incorrect Usage)
127 indicates that the command is not found (Command Not Found)
126 indicates not be performed (not executable AN)
> = 128 signal generator

 

reference:

https://www.cnblogs.com/itcomputer/p/4157859.html

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11390754.html