Re: declare overrides errexit

2010-09-24 Thread Greg Wooledge
On Fri, Sep 24, 2010 at 04:43:38PM +0100, Marc Herbert wrote: > Bourne shell is the only programming language I know that ignores > errors by default. "set -e" does not completely repair this design > flaw but it goes a long and appreciated way. C does too. This is probably not a coincidence.

Re: declare overrides errexit

2010-09-24 Thread Marc Herbert
Le 24/09/2010 15:38, Greg Wooledge a écrit : > If this is turning into a general discussion of errexit (set -e) then > please also see > > http://mywiki.wooledge.org/BashFAQ/105 and > http://fvue.nl/wiki/Bash:_Error_handling These pages are great and should be read. But from experience, I total

Re: declare overrides errexit

2010-09-24 Thread Greg Wooledge
If this is turning into a general discussion of errexit (set -e) then please also see http://mywiki.wooledge.org/BashFAQ/105 and http://fvue.nl/wiki/Bash:_Error_handling

Re: declare overrides errexit

2010-09-24 Thread Marc Herbert
Le 24/09/2010 14:52, Sascha Ziemann a écrit : > The expression: > > declare a='x'$(false) > > means: concatenate the string 'x', which evaluates to itself, and the > output of a sub shell, which performs the false command, and assign > the concatenated value to the variable a. > > This means th

Re: declare overrides errexit

2010-09-24 Thread Sascha Ziemann
>> 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. As far as I know about interpreters the arguments of an assig

Re: declare overrides errexit

2010-09-24 Thread Chet Ramey
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_VEN

Re: declare overrides errexit

2010-09-23 Thread Jan Schampera
Sascha Ziemann wrote: The following code prints "a". The second false terminates the script but the first does not. set -e declare a="a"$(false) echo $a b="b"$(false) echo $b The first operation succeeds, the second doesn't. The first operation

declare overrides errexit

2010-09-23 Thread Sascha Ziemann
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'