[Top][All Lists]

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

Re: Unexpected word splitting on $* when IFS is unset

From: Kevin Brodsky
Subject: Re: Unexpected word splitting on $* when IFS is unset
Date: Wed, 21 Jun 2017 19:43:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 21/06/2017 14:54, Chet Ramey wrote:
> On 6/20/17 1:33 AM, Eduardo A. Bustamante López wrote:
>> On Tue, Jun 20, 2017 at 01:13:07AM +0100, Kevin Brodsky wrote:
>> [...]
>>> When IFS is unset, unquoted $* undergoes word splitting as if IFS=' ',
>>> and not the expected IFS=$' \t\n'. All the other unquoted mass
>>> This is a regression that appeared in 4.3 and is still present on devel
>> [...]
>> AFAICT, the following patch fixes this.
> It's on the right track, but you still need to differentiate between the
> cases where IFS is unset (in which case the positional parameters need to
> be separated into individual words, and those individual words need to be
> split on $' \t\n') and where IFS is null (in which case split_on_spaces is
> used as an internal flag to satisfy the Posix requirement that $* expand
> into separate words no matter what IFS is set to).

That is also my reading of POSIX (and that's more or less what Bash's
manpage says as well), but it doesn't seem to be the case (even in <=4.2):

  $ set -- 'a b'
  $ IFS=''
  $ nb_args $*
  $ nb_args $@

Am I missing something? Other shells like dash or zsh seem to behave
exactly in the same way, so I must be...


reply via email to

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