The retval command will set the global return value to the numeric value given.
retval valueThis can be used to pass a value back from a script, or to pass a value to a script. The global return value is a global value available in any script, and is accessed with the $? construct. The global return value is set only by this function and the string comparison functions. It is initialized to zero on program startup, and retains the latest value indefinitely.