Re: [Help-bash] "local" modifies the behavior of "$?"
From:
Dan Douglas
Subject:
Re: [Help-bash] "local" modifies the behavior of "$?"
Date:
Tue, 25 Jun 2013 04:36:56 -0500
On Monday, June 24, 2013, Chet Ramey <address@hidden> wrote: > On 6/23/13 11:39 PM, Dan Douglas wrote: > >> Not documented but frequently asked.
> > Not quite. From the `SIMPLE COMMAND EXPANSION' section of the man page: > > "If there is a command name left after expansion, execution proceeds as > described below. Otherwise, the command exits. If one of the expan-
> sions contained a command substitution, the exit status of the command > is the exit status of the last command substitution performed. If > there were no command substitutions, the command exits with a status of
> zero." > > Similarly, the descriptions of `local' and `declare' list the conditions > under which they will return non-zero. > > Chet > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, ITS, CWRU address@hiddenhttp://cnswww.cns.cwru.edu/~chet/
> Yup, what Chet said... You guys might also be interested in this table I put together here: http://wiki.bash-hackers.org/dict/terms/exit_status#portability. It lists a good number of corner-cases like "! return" and others.