Question 15 of 20Pro Only
How do you define and use functions in Bash? How do you pass arguments and return values?
Sample answer preview
Functions in Bash help organize code into reusable blocks. There are two syntaxes for defining them: function greet { echo "Hello, $1" } # Or the POSIX-compatible style: greet() { echo "Hello, $1" } Arguments work just like script arguments.
functionlocal variablesreturnexit codecommand substitutionarguments