[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected word splitting on $* when IFS is unset
From: |
Greg Wooledge |
Subject: |
Re: Unexpected word splitting on $* when IFS is unset |
Date: |
Thu, 22 Jun 2017 07:51:12 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Jun 21, 2017 at 10:30:22PM -0400, Chet Ramey wrote:
> However, not all shells were consistent in their interpretation of the
> Posix rules. For instance, dash, which bills itself as being completely
> Posix conformant, produces 1 for that case (and expands to "ab"). The
> Bourne shell (SVR4.2 version) produces 1 as well, but expands it
> differently ("a b"). Debian's posh produces the same results as the Bourne
> shell. And so on.
Oh, wow. I didn't realize it was quite this bad.
$ dash
$ set -- a b
$ IFS=
$ args $*
1 args: <ab>
$ args $@
1 args: <ab>
$ args "$*"
1 args: <ab>
$ args "$@"
2 args: <a> <b>
$ ksh
$ set -- a b
$ IFS=
$ args $*
2 args: <a> <b>
$ args $@
2 args: <a> <b>
$ args "$*"
1 args: <ab>
$ args "$@"
2 args: <a> <b>
OK, going forward, I am officially considering any use of unquoted $*
or $@ in a script to be a BUG, an invocation of undefined behavior,
not acceptable, no excuses.
- Unexpected word splitting on $* when IFS is unset, Kevin Brodsky, 2017/06/19
- Re: Unexpected word splitting on $* when IFS is unset, Eduardo A . Bustamante López, 2017/06/20
- Re: Unexpected word splitting on $* when IFS is unset, Kevin Brodsky, 2017/06/20
- Re: Unexpected word splitting on $* when IFS is unset, Chet Ramey, 2017/06/21
- Re: Unexpected word splitting on $* when IFS is unset, Kevin Brodsky, 2017/06/21
- Re: Unexpected word splitting on $* when IFS is unset, Chet Ramey, 2017/06/21
- Re: Unexpected word splitting on $* when IFS is unset, Kevin Brodsky, 2017/06/21
- Re: Unexpected word splitting on $* when IFS is unset, Chet Ramey, 2017/06/21
- Re: Unexpected word splitting on $* when IFS is unset,
Greg Wooledge <=
- Re: Unexpected word splitting on $* when IFS is unset, DJ Mills, 2017/06/22
- Re: Unexpected word splitting on $* when IFS is unset, Robert Elz, 2017/06/23
- Re: Unexpected word splitting on $* when IFS is unset, Greg Wooledge, 2017/06/23
- Re: Unexpected word splitting on $* when IFS is unset, Chet Ramey, 2017/06/23
- Re: Unexpected word splitting on $* when IFS is unset, Robert Elz, 2017/06/23
- Re: Unexpected word splitting on $* when IFS is unset, Eduardo A . Bustamante López, 2017/06/24
- Re: Unexpected word splitting on $* when IFS is unset, Robert Elz, 2017/06/24
- Re: Unexpected word splitting on $* when IFS is unset, Eduardo A . Bustamante López, 2017/06/24
- Re: Unexpected word splitting on $* when IFS is unset, Chet Ramey, 2017/06/24
Re: Unexpected word splitting on $* when IFS is unset, Chet Ramey, 2017/06/21