Re: About the "return" build-in function in ksh

bsh_at_iname.com
Date: 07/13/04


Date: 12 Jul 2004 18:13:51 -0700


"0la 0." <mail_less@127.0.0.1> wrote in message news:<zEYFc.4257$dx3.33599@newsb.telia.net>...
> mrby wrote:
> > From the man page:
> > "return [status]
> > ...

Mind that the behavior of the return builtin is extended in ksh93:

"return [n] :
Causes a shell function or '. script' to return to the invoking
                        ^^^^^^^^^^^^^
script with the exit status specified by n. The value will be
the least significant 8 bits of the specified status. If n is
omitted, then the return status is that of the last command
executed. If return is invoked while not in a function or a
'. script', then it behaves the same as exit."

This is done as a consequence of allowing functions to be called
as arguments to ".", with identical behavior and invocation syntax,
as if a file-name were supplied instead.

=Brian



Relevant Pages

  • Re: Changing a users password non-interactively?
    ... You need expect and a setpass.expect script which ill add ... exit with a nasty warning. ... # Be careful of the COMMAND and UNDOCMD - they are dependant on your ...
    (comp.unix.aix)
  • Re: script does not always work the same each time.
    ... I have written a simple script to test code build and test run on a ... $lineterminationChar {append output $expect_out; ... exit 1;} ...
    (comp.lang.tcl)
  • Re: need small PHP job done
    ... i need help tweaking a PHP mail script; ... // check for a recipient email address and check the validity of it ... // check for an attachment if there is a file upload it ...
    (alt.php)
  • Re: OSR505 Signal trapping in shell scripts
    ... >>My test script is at the end. ... > process only gets one SIGHUP per fd. ... > end up doing ioctls on fd 0, which is your stopio'd telnetd pty. ... > of the exit function. ...
    (comp.unix.sco.misc)
  • Re: Changing a users password non-interactively?
    ... You need expect and a setpass.expect script which ill add ... exit with a nasty warning. ... # Be careful of the COMMAND and UNDOCMD - they are dependant on your ...
    (comp.unix.aix)