bug-bash
[Top][All Lists]
Advanced

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

Re: Funny behaviour of associative arrays


From: Robert Elz
Subject: Re: Funny behaviour of associative arrays
Date: Tue, 27 Jun 2023 19:47:41 +0700

    Date:        Tue, 27 Jun 2023 07:44:56 -0400
    From:        Greg Wooledge <greg@wooledge.org>
    Message-ID:  <ZJrLuJEyuOEnjkjI@wooledge.org>

  | I'm seeing some parser voodoo here.

Not doing field splitting, or globbing, is normal for any assignment statement.

Consider the simple (no arrays involved)

IFS=$', \t\n'
var=x*,y?
final=$var

regardless of what files matching "x*,y?" might exist, and that when
$var is expanded it contains an IFS character, and in other context
would be field split.   Not here.

That in itself has never been the issue here.   It isn't even surprising.

The real voodoo is in detecting the [] om the array value while
parsing the assignment statement, I suspect.   That's what is making
the difference in the two examples from the OP.

And of course, inside the command substitution, the outer context is
irrelevant - that's parsed and evaluated just as if it were a
standalone statement, and pathname expansions (and all the rest) and
field splitting (even quote removal) all happen in there.

kre





reply via email to

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