* On 06 Apr 2016, Cameron Simpson wrote: > On 06Apr2016 19:52, Ben Boeckel <maths...@gmail.com> wrote: > > On Thu, Apr 07, 2016 at 09:38:43 +1000, Cameron Simpson wrote: > > > For historic reasons, "$@" evaluates to a single "" if there were no > > > arguments > > > at all, introducing a spurious new empty argument. Possibly the thinking > > > was > > > > What shell is that? I've *never* encountered such a bug (well, I'd classify > > it > > as such at this point) and I do quite a bit of shell scripting. > > Probably fixed in modern shells. How long have you been shell scripting? (I > also consider it a bug; the incantation is a workaround.)
I vouch for this. I've encountered it in practice, although I couldn't presently say where or when. And I used the same solution, and I still write it if I want to be especially robust. I don't like to assume my code will never be run on an older machine, especially when I have a amiga running netbsd 1.0 and a next slab in the basement. (I recently got rid of all my other suns, sgis, and alphas. I used to be able to make a stronger case.) I'm not completely sure, but I *think* that I still saw this behavior on late-model bourne shells (i.e. not bash or zsh) derived from svr5 code the last time I used solaris or irix. But while it's probably a bug, it's the kind of bug that becomes entrenched and is actually dangerous to fix when a decent workaround is available. I think the architects of modernity made a mistake on this one -- although reverting it now would be a mistake for the same reason. -- David Champion • d...@bikeshed.us