[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: konsolebox
Subject: Re: declare a="$b" if $a previously set as array
Date: Wed, 17 Dec 2014 16:44:21 +0800

On Mon, Dec 15, 2014 at 1:48 PM, konsolebox <address@hidden> wrote:
> Last thing is `declare -x "$a_complete_assignment"` should not be allowed;
> even quoted assignments like `declare -x "$one=$two"` simply because
> they are already a reinterpreted form i.e. they are already evaluated
> with a pair of single or double-quotes before declare tries to evaluate
> them and it is were declare's behavior becomes inconsistent and it is
> were everything starts going wrong.  If we do allow it, how would we
> apply the proper rules to the expanded form of "$any"? - knowing that
> "$any" is already a terrible combination of raw constructs and values
> were literal values meant to be literal values become subject to
> misinterpretation as forms of assignment to an array.  And what if
> `$a_complete_assignment` contain `x=$something`, would we expand
> $something or not?  This just makes implementation of declare way more
> complicated, difficult and unclear.

Sorry about this.  I realized that we could actually allow this but only
in scalar form and with no other form of expansion.  So $something would
remain as '$something'.  In an expanded argument to declare, any character
that follows the first equal sign in it would be assigned to the
variable (or the first index of the array variable) as is.


reply via email to

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