Chet Ramey <chet.ramey@case.edu> wrote, on 04 May 2009:
>
> David Korn wrote:
> >
> > Going back to ksh88, and as Chet says, ksh93, -u applies to all parameters
> > not just variables. I don't have a copy of the original Bourne shell so
> > I don't know what it did in practice.
> >
> > Personally, I like the way it is in the standard and will change ksh93
> > behavior to conform if there is concensus that the standard is correct
> > as stands. This way, a script that runs should not get error when
> > invoked with sh -u unless there is a misspelled variable name or
> > an uninitialized variable.
> >
> > I will wait for a concensus to form before deciding to fix this.
>
> There has been resolute silence for several days. Do you think we have
> consensus that the standard is correct as written, despite the
> disconnection with historical practice?
I would like to see something in between. I think $* and $@ should be
treated as special cases, since it is only those parameters where it
is normal for them to be used when unset. For the other special
parameters, and particularly the positional parameters ($1, $2, etc.),
it makes sense for -u to treat their use when unset as an error.
Actually, $? and $! are the only special parameters other than $*
and $@ that can be used when unset if -u is on, so I wouldn't mind
if those two were treated as the special case rather than $* and $@,
but probably the wording will be simpler with $* and $@ as the
special case, e.g.:
"The shell shall write a message to standard error and immediately exit
when it tries to expand an unset parameter other than the '@' and '*'
special parameters."
--
Geoff Clare <g.clare@opengroup.org>
The Open Group, Thames Tower, Station Road, Reading, RG1 1LX, England
|