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/

Reply via email to