[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 <bash@tlinx.org> 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.
- Re: bug: return doesn't accept negative numbers, (continued)
- Re: bug: return doesn't accept negative numbers, Eric Blake, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Chet Ramey, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Mike Frysinger, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Chet Ramey, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/08
- Re: bug: return doesn't accept negative numbers, Eric Blake, 2011/08/09
- Re: bug: return doesn't accept negative numbers, Chet Ramey, 2011/08/09
- Message not available
- Re: bug: return doesn't accept negative numbers, Stephane CHAZELAS, 2011/08/11
- Re: bug: return doesn't accept negative numbers, Linda Walsh, 2011/08/11
Re: bug: return doesn't accept negative numbers,
Dennis Williamson <=