[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cannot catch returncode if assigning local variables in functions
From: |
Chet Ramey |
Subject: |
Re: cannot catch returncode if assigning local variables in functions |
Date: |
Sun, 21 Jun 2009 22:21:45 -0400 |
User-agent: |
Thunderbird 2.0.0.21 (Macintosh/20090302) |
Bastian Bittorf wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i486
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
> -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2
> -Wall
> uname output: Linux bastian-laptop 2.6.28-13-generic #44-Ubuntu SMP Tue Jun 2
> 07:57:31 UTC 2009 i686 GNU/Linux
> Machine Type: i486-pc-linux-gnu
>
> Bash Version: 3.2
> Patch Level: 48
> Release Status: release
>
> Description:
>
> when assigning local variables in functions,
> you cannot use the returncode which is generated
> for quick branching with '||' or '&&'
The `local' builtin returns success if the assignment is performed
correctly. An assignment statement's return status is the status of
the last command substitution performed, or zero if none was performed.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/