On Wed, May 04, 2011 at 03:40:01PM -0500, Rafael Fernandez wrote:
> [...] I am used to the behavior of sh on NetBSD which does not require
> enclosing positional parameters. I believe it is adequately expressed in the
> manual page,

The NetBSD manpage documents it as usually implemented.  I guess the
"unexpected" behaviour is rather a simple bug introduced on NetBSD
and the history (going offtopic now) was as follows:

The original ash '89 had not implemented or documented multi-digit
positional parameters at all (it was rather a SVR4 sh clone).

4.4BSD alpha '92 suddenly documented it,
    "...braces, which are optional except for positional parameters
     with more than one digit..."
     http://www.in-ulm.de/~mascheck/various/ash/44bsdalpha.1.html
but interestingly had not implemented anything like that.  And nothing
changed in later Berkeley variants.

NetBSD 1.2 '97 then just tried to fix this,
http://cvsweb.netbsd.org/bsdweb.cgi/src/bin/sh/parser.c#rev1.33 ff.
and apparently introduced the bug of handling $10 like ${10}.
The abovementioned sentence in the manpage was left unchanged.


Some ash variants were derived from NetBSD and inherited the bug, like
dash and busybox.  Others were derived differently and behave as expected,
like FreeBSD, http://www.in-ulm.de/~mascheck/various/ash/ash.png

Reply via email to