[Top][All Lists]

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

Re: Declaring a local variable circumvents "-e"

From: Bob Proulx
Subject: Re: Declaring a local variable circumvents "-e"
Date: Wed, 24 Sep 2008 22:13:32 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Chet Ramey wrote:
> Björn Augustsson wrote:
> > fun_bad() { local bah=$( false ); }
> > fun_good() { local bah ; bah=$( false ); }
> The `local' command returns success if the variable assignment succeeds,
> which it does.  The command substitution doesn't affect its exit status.
> This is how all builtins that affect variable attributes (declare/typeset,
> export, readonly) should behave.

Note that this is also the way "export" works too.


reply via email to

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