[Top][All Lists]

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

Re: Word splitting for $@ in variable assignment

From: Nora Platiel
Subject: Re: Word splitting for $@ in variable assignment
Date: Fri, 25 Jun 2021 21:42:21 +0200

On 2021-06-26 01:05, Robert Elz wrote:
>   | If Chet feels that a change is needed here, I would remove the "with
>   | the exception of" clause entirely.  Just say "Word splitting is not
>   | performed."
> My suspicion (I'm guessing) is that exception is to cover
>         x=("$@")

`name=[value]' as described under 3.4 Shell Parameters doesn't include arrays.
That case is documented under 6.7 Arrays:

| name=(value1 value2 … )
| [...]
| Each value in the list undergoes all the shell expansions described
| above (see Shell Expansions).

Which includes word splitting, and not only with "$@" but with anything (e.g. 
`x=($y)' is also subjected to word splitting, while `x=$y' isn't).

In the context of `name=[value]' I don't see any exception.

> where the "$@" is expanded to multiple words (but still this isn't word
> splitting).

Yes, "$@" expanding to multiple words is not "word splitting", but it happens 
in contexts where word splitting is performed.
In contexts where word splitting is not performed it expands to a single word.

reply via email to

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