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 09:54:43 -0500
User-agent:
NeoMutt/20170113 (1.7.2)
On Sat, Jun 24, 2017 at 09:10:34PM +0700, Robert Elz wrote:
[...]
> The bugs in various implementations cause problems, yes, dealing with
> someone else's mistakes (and especially doing it in a way that things
> still work when the bugs get fixed) can be difficult.
>
> But the rules, no, the rules for $* are actually trivial.
>
> Unquoted, $* (or $@ which is identical) is exactly the same
> as the sequence
>
> $1 $2 $3 ...
>
> would be, if we knew in advance how many of those we should write
> (which can be 0 of them of course.)
>
> It is exactly that simple (ignoring implementation bugs.)
I think we are arguing about different things. My point (and which I
think is Greg's point) is that we should start recommending shell script
writers to stay away from the unquoted expansions of $* and $@.
Yes, the POSIX rules might be "trivial", but the actual implementations
are not, and shell script programmers care about running their scripts
on real implementations.
--
Eduardo Bustamante
https://dualbus.me/