Stepan Kasal <kasal@xxxxxx> writes: > 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. The context is a general rewrite (the preceding text is "More generally, one can always rewrite @samp{! @var{command}} as:") so we should give a rewrite that works in the general case. Since "!" always returns exit status 0 or 1, the rewrite should too. So we can't use "false" in the rewrite. I installed this hopefully-simpler patch for the "test !" problem: 2005-01-21 Paul Eggert <eggert@xxxxxxxxxxx> * doc/autoconf.texi (Limitations of Builtins): Clarify that "if test -d foo; ..." is portable. Suggested by Stepan Kasal. --- autoconf.texi 21 Jan 2005 00:03:40 -0000 1.865 +++ autoconf.texi 21 Jan 2005 19:31:51 -0000 1.866 @@ -11082,8 +11082,9 @@ operators; consequently, Posix does not 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}: -@samp{test ! -r foo || exit 1}. +It is safe to use @samp{!} as a @command{test} operator. For example, +@samp{if test ! -d foo; @dots{}} is portable even though @samp{if ! test +-d foo; @dots{}} is not. @item @command{test} (files) _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf