[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected word splitting on $* when IFS is unset
From: |
Eduardo A . Bustamante López |
Subject: |
Re: Unexpected word splitting on $* when IFS is unset |
Date: |
Sat, 24 Jun 2017 07:59:25 -0500 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Sat, Jun 24, 2017 at 09:35:34AM +0700, Robert Elz wrote:
[...]
> In cases where IFS is not a null string, the broken implementations mostly
> tend to work OK (sometimes perhaps only by a fluke), and even more work
> properly if IFS has its default value or something similar, that is
> where IFS[0] == ' ' to borrow an inappropriate way of writing it.
[...]
> These may be rare, but just saying "never do it" is too much.
Greg's advice is directed towards novice / intermediate shell script
programmers. I think we can all agree that the rules (and bugs) around
the expansion of $* are too complex. As a shell script writer trying to
make use $*, you'd have to verify that it works as expected across all
the shells (and even between different versions of the same shell).
IMO, it's easier to just document this kind of expansion as "undefined
behavior". Pretty much like we do with `errexit' already.
--
Eduardo Bustamante
https://dualbus.me/
- Re: Unexpected word splitting on $* when IFS is unset, (continued)
- 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, 2017/06/22
- 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 <=
- 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