bug-bash
[Top][All Lists]
Advanced

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

Re: declare in a function makes a variable unable to be found with decla


From: SN
Subject: Re: declare in a function makes a variable unable to be found with declare -p in some cases
Date: Tue, 17 Feb 2015 22:31:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

> Already reported:
>
> * test -v: http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00099.html
> * declare -p arrname: 
> https://lists.gnu.org/archive/html/bug-bash/2012-11/msg00084.html

The second thread is about something completely different as I
understand it.
It is about variables whose values aren't explicitly assigned a value.

Here:

        # OK
        $ x() { declare -a var=(); declare -p var; }; x
        declare -a var='()'
        # not OK
        $ y() { declare -a var='()'; declare -p var; }; y
        bash: declare: var: not found

in both cases a value is assigned, yet the shell behaves differently in the 
second one.




reply via email to

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