[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AS_EXECUTABLE_P again
From: |
Stepan Kasal |
Subject: |
Re: AS_EXECUTABLE_P again |
Date: |
Fri, 21 Jan 2005 12:48:23 +0100 |
User-agent: |
Mutt/1.4.1i |
Hi,
On Fri, Jan 21, 2005 at 11:54:45AM +0100, Ralf Wildenhues wrote:
> * Stepan Kasal wrote:
> > 2) The autoconf manual says you cannot use `test ! -d' with `if'.
...
> | You may use @samp{!} with @command{test}, but not with @command{if}:
> | @samp{test ! -r foo || exit 1}.
>
> means that you may use
> if test ! ...
> but not
> if ! test ...
> portably.
oh, I see.
Paul, can I commit the attached below?
(I would mail it to autoconf-patches, of course.)
A related question:
The item about `!' mentions the following code:
if @var{command}; then (exit 1); else :; fi
Can I change the suggestion to
if @var{command}; then false; else :; fi
Yes, the exit code might be 255, but it shouldn't matter.
I think `false' is often a builtin, so we can save one process creation.
Stepan
2005-01-21 Stepan Kasal <address@hidden>
* doc/autoconf.texi (Limitations of Builtins) <test>: Clarify that
`test !' is portable.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.865
diff -u -r1.865 autoconf.texi
--- doc/autoconf.texi 21 Jan 2005 00:03:40 -0000 1.865
+++ doc/autoconf.texi 21 Jan 2005 11:38:24 -0000
@@ -11082,8 +11082,9 @@
is nonportable. If you combine @samp{&&} and @samp{||} in the same
statement, keep in mind that they have equal precedence.
-You may use @samp{!} with @command{test}, but not with @command{if}:
address@hidden ! -r foo || exit 1}.
+It's safe to use @samp{!} as an @emph{argument} to @command{test}, even
+with @command{if}: @samp{if test ! -d foo; then ...; fi}.
+But you cannot use @code{if ! test -d foo}; see the item @command{!} above.
@item @command{test} (files)