Citation:
EXIT STATUS
Errors detected by the shell, such as syntax errors, cause the shell to return a non-zero exit status. If the shell is being used non-interactively, then execution of the shell file is abandoned unless the error occurs inside a subshell in which case the subshell is abandoned. Otherwise, the shell returns the exit status of the last command executed (see also the exit command above). Run time errors detected by the shell are reported by printing the command or function name and the error condition. If the line number that the error occurred on is greater than one, then the line number is also printed in square brackets ([]) after the command or function name.
Citation:
sh
exit [n]
return [n]
csh
exit [ ( expr )]
goto label
ksh
*exit [n]
*return [n]
....
ksh
exit will cause the calling shell or shell script to exit
with the exit status specified by n. The value will be the
least significant 8 bits of the specified status. If n is
omitted then the exit status is that of the last command
executed. When exit occurs when executing a trap, the
last command refers to the command that executed before the
....
return causes a shell function or '.' script to return to
the invoking script with the return status specified by n.
The value will be the least significant 8 bits of the speci-
fied status. If n is omitted then the return status is that
of the last command executed. If return is invoked while
not in a function or a '.' script, then it is the same as an
exit.
8 bits ==> 0 - 255 ou -128 +127 (dans l'hypothèse de la numérotation classique)