Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit return information from bash functions #1

Closed
idesai opened this issue Jun 9, 2019 · 1 comment
Closed

Audit return information from bash functions #1

idesai opened this issue Jun 9, 2019 · 1 comment

Comments

@idesai
Copy link
Member

idesai commented Jun 9, 2019

https://www.linuxjournal.com/content/return-values-bash-functions
Bash functions, unlike functions in most programming languages do not allow you to return a value to the caller. When a bash function ends its return value is its status: zero for success, non-zero for failure. To return values, you can set a global variable with the result, or use command substitution, or you can pass in the name of a variable to use as the result variable.

@idesai
Copy link
Member Author

idesai commented Jun 9, 2019

Using global variables -

Example:


OR

The default return value is the exit value of the last statement executed within the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant