Open In App

return command in Linux with examples

Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • return –help : It displays help information.


Last Updated : 24 May, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads