Eric Blake wrote:
On 08/05/2011 05:41 PM, Linda Walsh wrote:
Seem to fail on any negative number, but 'exit status' is defined
as a short int -- not an unsigned value (i.e. -1 would return 255).
In bash, 'return -- -1' sets $? to 255 (note the --). But since that is
already an extension (POSIX does not require 'return' to support -- any
more than it is required to support an argument of -1), I agree with
your argument that bash would be more useful if, as an extension to
POSIX, it would handle 'return -1' - in fact, that would match ksh
behavior. Conversely, since portable code already can't use it, it's no
skin off my back if nothing changes here.
---
How about portable code using:
(exit -1); return
It's ugly, but would seem to be the portable/official way to
do this.