Linux Command
return
Exit from the function and return a value.
Summary
return [n]
The main purpose
Parameters
n (optional): integer.
return value
The return value is the value of the parameter n you specify. If the parameter you specify is greater than 255 or less than 0, then the return value will always be between 0 and 255 by adding or subtracting 256.
Executing the return statement outside the function will return failure.
example
#!/usr/bin/env bash
# Define a function with a return value greater than 255
example() {
return 259
}
#Execute function
example
# show 3
echo $?
Notice
-
This command is a built-in bash command. For related help information, please see the
helpcommand.


