exit, return, goto — Shell Built-in Functions to Enable the Shell to Advance Beyond Its Sequence of Steps

Synopsis

sh
exit [n] 
return [n] 
csh
exit [(expr)] 
goto label
						
ksh
* exit [n] 
* return [n] 

Description

Bourne Shell

exit exits the calling shell or shell script with the exit status specified by n . If you omit n , the exit status is that of the last command executed (an end-of-file exits the shell).

return exits a function with the return value specified by n . If you omit n , the return status is that of the last command executed.

C Shell

exit exits the calling shell or shell script, either with the value of the status variable or with the value specified by the expression expr .

The goto built-in uses a specified label as a ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.