bug-bash
[Top][All Lists]
Advanced

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

Re: declare overrides errexit


From: Chet Ramey
Subject: Re: declare overrides errexit
Date: Fri, 24 Sep 2010 09:28:23 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

On 9/23/10 5:09 AM, Sascha Ziemann wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/home/users/ziemann/share/locale'
> -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
> -I./lib   -g -O2
> uname output: Linux t4mshpapl104.dcn.detemobil.de
> 2.6.18-194.8.1.el5PAE #1 SMP Wed Jun 23 11:16:22 EDT 2010 i686 i686
> i386 GNU/Linux
> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 4.1
> Patch Level: 0
> Release Status: release
> 
> Description:
>       The errexit option does not work, if an error occures in a declare 
> statement.

There is no error, because `declare' is defined to return success if the
variable assignment is performed without an error.  The fact that an
assignment statement causes the shell to exit is a side effect of how
Posix defines the return status of an assignment statement:

http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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