bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: document -u $@ $* special case


From: Stephane Chazelas
Subject: Re: document -u $@ $* special case
Date: Wed, 26 Nov 2008 19:35:45 +0000
User-agent: Mutt/1.5.16 (2007-09-19)

On Wed, Nov 26, 2008 at 01:25:17PM -0500, Chet Ramey wrote:
> jidanni@jidanni.org wrote:
> > Gentlemen, I have discovered a documentation oversight. In the manual,
> > we see:
> > set -u --
> > : $@ $*
> > : $1
> > 
> > and
> > 
> > set --
> > : ${*?} ${@?}
> > : ${1?}
> > 
> > Therefore the -u paragraph needs to add that "$@ and $* unset are not
> > caught by -u, but $1, $2... are".
> 
> You've discovered a bug.  They should be treated the same way.
[...]

Though one may argue that $@ and $* are _set_ to the list of
arguments which in this case is empty, so it could be considered
as always being set. POSIX doesn't mention that they may ever be
unset.

zsh and ash behave like bash. Solaris 7 sh, ksh93 and pdksh
don't.

However zsh and ash differ from bash in:

$ ash -c 'echo "<${*+a}>"'
<a>
$ zsh -c 'echo "<${*+a}>"'
<a>
$ bash -c 'echo "<${*+a}>"'
<>

So it's true there's an inconsistency in bash.

I would also be tempted to say that after

a=()

a[@] and a[*] should be considered set. That's the case in zsh
but not in ksh93 or bash, but then zsh arrays are quite
different from ksh/bash arrays.

-- 
Stéphane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]