[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Word splitting for $@ in variable assignment
From: |
Greg Wooledge |
Subject: |
Re: Word splitting for $@ in variable assignment |
Date: |
Fri, 25 Jun 2021 12:11:33 -0400 |
On Fri, Jun 25, 2021 at 03:15:25PM +0200, Nora Platiel wrote:
> But at least it is documented, and that part of the doc is clear to me.
> The part of the doc that I'm complaining about is this one:
>
> | A variable may be assigned to by a statement of the form
> | name=[value]
> | [...]
> | Word splitting is not performed, with the exception of "$@" as
> | explained below.
This isn't the full sentence in the current man page. In the bash 5.1
man page, it says:
Word splitting is not
performed, with the exception of "$@" as explained below under Special
Parameters.
So, we need to look at Special Parameters:
@ Expands to the positional parameters, starting from one. In
contexts where word splitting is performed, this expands each
positional parameter to a separate word; if not within double
quotes, these words are subject to word splitting. In contexts
where word splitting is not performed, this expands to a single
word with each positional parameter separated by a space.
That matches the behavior that I saw (and pasted on this mailing list the
other day). (Which by the way is *not* the same as "$*" unless IFS happens
to be unset or to begin with a space.)
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."
- Re: Word splitting for $@ in variable assignment, (continued)
- Re: Word splitting for $@ in variable assignment, Ilkka Virta, 2021/06/24
- Re: Word splitting for $@ in variable assignment, Greg Wooledge, 2021/06/24
- Re: Word splitting for $@ in variable assignment, Nora Platiel, 2021/06/24
- Re: Word splitting for $@ in variable assignment, Nora Platiel, 2021/06/25
- Re: Word splitting for $@ in variable assignment, Nora Platiel, 2021/06/25
- Re: Word splitting for $@ in variable assignment, Nora Platiel, 2021/06/25