bug-bash
[Top][All Lists]
Advanced

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

Re: declare a="$b" if $a previously set as array


From: Chet Ramey
Subject: Re: declare a="$b" if $a previously set as array
Date: Tue, 16 Dec 2014 15:32:50 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 12/15/14, 9:41 PM, Linda Walsh wrote:

> Though I just ran into a bit of weirdness (in 4.2.45)
> (output is commented out and indented):
> 
> env -i /bin/bash --norc --noprofile
> declare -a ar=(ONE TWO THREE)
> declare -p ar
> #       declare -a ar='([0]="ONE" [1]="TWO" [2]="THREE")'
> 
> #### add 'l', and note output:
> 
> declare -al ar=(${ar[@]})
> declare -p ar
> #       declare -al ar='([0]="ONE" [1]="TWO" [2]="THREE")'   # Note - no
> conversion
> 
> # ok, now set export:
> declare -x ar=(${ar[@]})
> declare -p ar
>         declare -axl ar='([0]="one" [1]="two" [2]="three")' # now "-l"
> takes effect

Thanks for the report.  This is a bug, and will be fixed in the next
release of bash.

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]