` Stephane CHAZELAS wrote:
2011-08-08, 13:55(-07), Linda Walsh:
[...]
and both 'exit' and 'return' should return error "ERANGE" if "--posix" is
set, and -1 is given. Iinvalid option doesn't make as much sense, in
this situtation, if it was -k or -m, sure...but in this case, it's a fact
th
On Mon, Aug 8, 2011 at 8:42 AM, Bob Proulx wrote:
>
> People sometimes read the POSIX standard today and think it is a
> design document. Let me correct that misunderstanding. It is not.
> POSIX is an operating system non-proliferation treaty.
Love it!
jon.
2011-08-08, 13:55(-07), Linda Walsh:
[...]
> and both 'exit' and 'return' should return error "ERANGE" if "--posix" is
> set, and -1 is given. Iinvalid option doesn't make as much sense, in
> this situtation, if it was -k or -m, sure...but in this case, it's a fact
> that --posix artificially limi
On 8/9/11 8:53 AM, Eric Blake wrote:
> On 08/08/2011 08:14 PM, Chet Ramey wrote:
>> On 8/8/11 9:42 PM, Mike Frysinger wrote:
>>> On Monday, August 08, 2011 21:20:29 Chet Ramey wrote:
On 8/8/11 8:53 AM, Eric Blake wrote:
> However, you are on to something - since bash allows 'exit -1' as an
On 08/08/2011 08:14 PM, Chet Ramey wrote:
On 8/8/11 9:42 PM, Mike Frysinger wrote:
On Monday, August 08, 2011 21:20:29 Chet Ramey wrote:
On 8/8/11 8:53 AM, Eric Blake wrote:
However, you are on to something - since bash allows 'exit -1' as an
extension, it should similarly allow 'return -1' as
Chet Ramey wrote:
Sure. It's just removing the three lines of code that were added
between bash-3.2 and bash-4.0. The question was always whether that's
the right thing to do, and whether the result will behave as Posix
requires.
That explains why I never ran into this before!
On 8/8/11 9:42 PM, Mike Frysinger wrote:
> On Monday, August 08, 2011 21:20:29 Chet Ramey wrote:
>> On 8/8/11 8:53 AM, Eric Blake wrote:
>>> However, you are on to something - since bash allows 'exit -1' as an
>>> extension, it should similarly allow 'return -1' as the same sort of
>>> extension.
On Monday, August 08, 2011 21:20:29 Chet Ramey wrote:
> On 8/8/11 8:53 AM, Eric Blake wrote:
> > However, you are on to something - since bash allows 'exit -1' as an
> > extension, it should similarly allow 'return -1' as the same sort of
> > extension. The fact that bash accepts 'exit -1' and 'ex
On 8/8/11 8:53 AM, Eric Blake wrote:
> However, you are on to something - since bash allows 'exit -1' as an
> extension, it should similarly allow 'return -1' as the same sort of
> extension. The fact that bash accepts 'exit -1' and 'exit -- -1', but only
> 'return -- -1', is the real point that
Bob Proulx wrote:
Linda Walsh wrote:
Bob Proulx wrote:
Exit codes should be in the range 0-255.
---
I suppose you don't realize that 'should' is a subjective opinion that
sometimes has little to do with objective reality.
Sigh. Okay. Keep in mind that turn about is fair play. Yo
Eric Blake wrote:
(exit -1); return
That's not portable, either. exit is allowed to reject -1 as invalid.
POSIX is clear that exit and return have the same constraints - if an
argument is provided, it must be 0-255 to be portable.
However, you are on to something - since bash allows 'exi
On 08/07/2011 02:35 PM, Linda Walsh wrote:
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 --).
Chet Ramey wrote:
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 all
Linda Walsh wrote:
> Bob Proulx wrote:
> >Exit codes should be in the range 0-255.
> ---
> I suppose you don't realize that 'should' is a subjective opinion that
> sometimes has little to do with objective reality.
Sigh. Okay. Keep in mind that turn about is fair play. You are
giving it t
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 e
On 8/7/11 4:35 PM, Linda Walsh wrote:
> ---
> How about portable code using:
>
> (exit -1); return
return $(( -1 & 255 ))
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduh
Bob Proulx wrote:
Linda Walsh wrote:
How about portable code using:
(exit -1); return
It's ugly, but would seem to be the portable/official way to
do this.
Exit codes should be in the range 0-255.
---
I suppose you don't realize that 'should' is a subjectiv
Linda Walsh wrote:
> How about portable code using:
>
> (exit -1); return
>
> It's ugly, but would seem to be the portable/official way to
> do this.
Exit codes should be in the range 0-255.
Bob
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 (P
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).
Bob Proulx wrote:
Eric Blake wrote:
Linda Walsh wrote:
I guess I don't use negative return codes that often in shell, but
I use them a
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 wrote:
>
>
>
> I guess I don't use negative return codes that often in shell, but
>
Eric Blake wrote:
> Linda Walsh wrote:
> >I guess I don't use negative return codes that often in shell, but
> >I use them as exit codes reasonably often.
For all of the reasons Eric mentioned you won't ever actually be able
to see a negative result of an exit code however.
> >'return' barfs on "
On 08/05/2011 05:41 PM, Linda Walsh 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
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
24 matches
Mail list logo