Gavin Smith <[email protected]> writes:

> On 1 July 2015 at 21:43, Gavin Smith <[email protected]> wrote:
>>
>> I seem to remember there was something wrong about the "local"
>> function, but I can't remember what it was.
>
> This test for "local" is flawed:
>
> (
>   foo=bar
>   test_local () {
>     local foo=foo
>   }
>   test_local >/dev/null 2>&1
>   test $foo = bar
> ) || eval '
> local () {
>   case $1 in
>     *=*) eval "$1";;
>   esac
> }
> '
> It appears to assume that "local foo=foo" will assign "foo" to foo if
> local doesn't exist, but in fact all it does is print an error
> message, and leave foo as was.

What's the point of this anyway?  Why not just remove all uses of local
if it's expected to do nothing?

Andreas.

-- 
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Reply via email to