[Top][All Lists]

[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: Sun, 14 Dec 2014 15:42:30 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 12/9/14 5:59 AM, Stephane Chazelas wrote:

> BTW, it's worth noting (and maybe documenting) that word
> splitting and filename generation are performed in:
> declare -g $var=$something
> (or declare ''var=$something or declare f\oo=$bar...)
> So it must be indeed:
> declare -g "$var=$something"

Again, this is the difference between builtins and keywords.  Arguments
to builtin commands undergo the usual set of word expansions.  Posix
acknowledges and allows this.  These aren't assignment statements as
bash (and Posix) defines them, so they're not treated specially when
used as arguments to declaration commands.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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