Exit from the function and return a value.
return [n]
n (optional): integer.
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.
#!/usr/bin/env bash
# Define a function with a return value greater than 255
example() {
return 259
}
#Execute function
example
# show 3
echo $?