On 8/7/11 6:03 PM, Linda Walsh wrote:

> Bash itself is inconsistent in that it accepts exit values the same as
> every other
> program, but limits return values to a particular subset.

Bash accepts any value you want to give to `return' and strips it to
8 bits, as the standard allows.  Read the error message closely: it says
`invalid option'.  return doesn't accept any options, even ones that
might possibly be interpreted as negative status values -- which the
standard doesn't allow anyway.  As Eric Blake showed, `return -- -1' works
just fine, and sets $? to 255.  If you don't want to type the three extra
characters, use the $(( ... )) idiom I posted earlier.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to