Open In App

return command in Linux with examples

return command is used to exit from a shell function. It takes a parameter [N], if N is mentioned then it returns [N] and if N is not mentioned then it returns the status of the last command executed within the function or script. N can only be a numeric value.

Syntax:



return [N]

Example:



Note: echo $? is used to display the last return status.

Option:

Article Tags :