Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #12134
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: ${1+"$@"} does not generate multiple words if IFS is empty |
| Date | 2015-12-30 08:00 -0500 |
| Message-ID | <mailman.1346.1451480452.843.bug-bash@gnu.org> (permalink) |
| References | <56835243.0Dp3As7Vk0rP8qDy%martijn@inlv.org> <87io3gtiku.fsf@igel.home> |
On Wed, Dec 30, 2015 at 10:02:41AM +0100, Andreas Schwab wrote:
> martijn@inlv.org writes:
>
> > The substitution ${1+"$@"} should resolve to "$@" if there is at
> > least one parameter -- i.e. one word per parameter. This works fine
> > if IFS contains any character or is unset. If IFS is empty, it
> > instead resolves to the equivalent of "$*", i.e. a single word
> > concatenating all the parameters without a separator. IFS should
> > not influence the behaviour of "$@" under any circumstances.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
>
> "If the value of IFS is null, no field splitting shall be performed."
By itself that doesn't explain it. But if you scroll up to
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02
it says:
@
Expands to the positional parameters, starting from one. When the
expansion occurs within double-quotes, and where field splitting (see
Field Splitting) is performed, each positional parameter shall expand
as a separate field [...]
Back to gnu.bash.bug | Previous | Next | Find similar
Re: ${1+"$@"} does not generate multiple words if IFS is empty Greg Wooledge <wooledg@eeg.ccf.org> - 2015-12-30 08:00 -0500
csiph-web