On Sat, Dec 10, 2005 at 02:48:15PM +0100, Andreas Metzler wrote:
> On 2005-12-08 Peter Fales <[EMAIL PROTECTED]> wrote:
> [...]
> > #! /bin/sh
>
> > and around line 249 we have
>
> > if ! bigrams=`mktemp -t updatedbXXXXXXXXX`; then
> >
> > However (sadly), the solaris bin/sh doesn't support the "!" operation.
>
> Afaik using ! to change the exit status of a pipeline to its logical
> NOT is a required POSIX feature.
Yes, this is true. Section 2.9.2 of the POSIX standard says:-
|| 2.9.2 Pipelines
|| {...}
|| [!] command1 [ | command2 ...]
|| {...}
|| If the reserved word ! does not precede the pipeline, the exit status
|| shall be the exit status of the last command specified in the
|| pipeline. Otherwise, the exit status shall be the logical NOT of the
|| exit status of the last command.
See http://www.opengroup.org/onlinepubs/009695399/toc.htm
Anyway, the Solaris /bin/sh is not POSIX compliant, and has never
pretended to be. The conforming shell on Solaris is /usr/xpg4/bin/sh,
though I'm not clear on exactly which edition of the POSIX standard it
complies with.
The updatedb shell sc ript is already dynamically generated by
variable substitution. It would be possible to have a substitution
"#! @posixshell@" at the top of the file. I'm guessing though that it
is nontrivial to find a POSIX shell on a random Unix (grr, what would
it have cost to standardise on a /usr/posix/2004/sh symbolic link?).
Indeed, some environments (HPUX 8, I think) don't have one at all.
So I'll just remove the '!' and add an extra arm to that if statement.
That will allow the Solaris shell to drag itself to the end of the
script, I suppose.
I feel a bit daft for using the construct to be honest, because I know
perfectly well that '!' is not supported everywhere. I just get fed
up of writing stupid constructs like this:
if flurble ; then
: hooray, let us waste some CPU cycles.
else
issue an error message and exit
fi
The trouble is I don't really like this construct either:
flurble || {
issue an error message and exit
}
Regards,
James.
_______________________________________________
Bug-findutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-findutils