[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/37493: /bin/sh exits if shift fails, but shouldn't
On Sun, 25 May 2008, David Holland wrote:
> > >How-To-Repeat:
> > $ sh -c 'set -ex; shift || echo failed.'
> > + shift
> > shift: can't shift that many
> I'm thinking that shift should be changed to an ordinary builtin
> instead of a special builtin. But I'm not sure what other implications
> this might have. Would someone who understands the finer points of sh
> like to comment?
shift is required to be a special built-in utility
According to one part of SUSv3, syntax errors in
special built-in utilities are permitted, but
not required, to make the shell exit immediately
According to another part of SUSv3, an "option or operand error"
in a special built-in utility means that the shell must exit
I think that trying to shift too many parameters would fall under this
> Also... ksh exhibits the same behavior. So, apparently, does the
> original Bourne shell. bash and zsh do not. Which makes it unclear if
> it's really a bug or not, too...
I say "not a bug".
--apb (Alan Barrett)
Main Index |
Thread Index |