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. The value is initialized to zero whenever a script is executed, so that zero is the default return value. The global return value is a global value available in any script and the command prompt line, and is accessed with the special variable name $?. The global return value is set by this function and the string comparison functions, and optionally by the return function.