|
in a shell script:
function_name # call the function
return_val=$? # store the return value
echo $return_val # do something with the return value
Function can return a value, called an exit status
The exit status may be explicitly specified by a return statement, otherwise it is the exit status of the last command in the function
This exit status may be used in the script by referencing it as $?
The largest positive integer a function can return is 255
|