bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug: return doesn't accept negative numbers


From: Dennis Williamson
Subject: Re: bug: return doesn't accept negative numbers
Date: Fri, 5 Aug 2011 19:39:31 -0500

return (and exit) returns an exit code between 0 and 255. Zero means
true and anything else means false

If you want a function to "return" a value, use printf or echo.

On Fri, Aug 5, 2011 at 6:41 PM, Linda Walsh <address@hidden> wrote:
>
>
>
> I guess I don't use negative return codes that often in shell, but
> I use them as exit codes reasonably often.
>
> 'return' barfs on "return -1"...
>
> Since return is defined to take no options, and ONLY an integer,
> as the return code, it shouldn't be hard to fix.
>
> 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).
>
>
>
>
>
>



-- 
Visit serverfault.com to get your system administration questions answered.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]