powscript icon indicating copy to clipboard operation
powscript copied to clipboard

Expand bug: ~name=(a b c) treated as the start of a function

Open fcard opened this issue 5 years ago • 1 comments

While implementing this:

array:shift(A)
  expand
    ~A=(${~A[@]:slice 1})

I learned that the array initializer expression is parsed like the start of a function. booo! Technically this is a valid bash function:

~function=() {
  echo "Straaange, isn't it??"
}

So I will have to make a special case for a single leading tilde in the expand zone.

fcard avatar Sep 08 '20 16:09 fcard

wow this is indeed odd :D

coderofsalvation avatar Jan 21 '22 22:01 coderofsalvation