libtool-patches
[Top][All Lists]
Advanced

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

Re: test && test --> test -a


From: Robert Boehne
Subject: Re: test && test --> test -a
Date: Wed, 05 Dec 2001 15:01:17 -0600

Alrighty then, with all that said, I'm in favor of removing -a
and replacing with &&.  Not that && is better in the current
ltmain.in, but because it's precidence is straightforward and
future changes to the same line of "test"'s will have less
trouble.

Agree? 

If so, I'll check in Jens' patch replacing -a with &&.

Thanks!

Robert


Tim Van Holder wrote:
> 
> > For what it's worth, autoconf says the following.  (Oh, but is this
> > saying POSIX doesn't specify -a and -o at all, or only that it doesn't
> > specify their precedence?)
> 
> Draft 6 of the new POSIX standard lists -a, -o and parens as XSI
> extensions.  It also has this to say:
> 
> Scripts should be careful when dealing with user-supplied input that
> could be confused with primaries and operators. Unless the application
> writer knows all the cases that produce input to the script, invocations
> like:
> 
>         test "$1" â^?a "$2"
> 
> should be written as:
> 
>         test "$1" && test "$2"
> 
> to avoid problems if a user supplied values such as $1 set to â??!â?? and $2 
> set to the null string.
> That is, in cases where maximal portability is of concern, replace:
> 
>         test expr1 â^?a expr2
> 
> with:
> 
>         test expr1 && test expr2
> 
> and replace:
> 
>         test expr1 â^?o expr2
> 
> with:
> 
>         test expr1 || test expr2
> 
> but note that, in test, â^?a has higher precedence than â^?o while "&&" and 
> "||" have equal
> precedence in the shell.
> 
> Parentheses or braces can be used in the shell command language to effect 
> grouping.
> 
> Parentheses must be escaped when using sh; for example:
> 
>         test \( expr1 â^?a expr2 \) â^?o expr3
> 
> This command is not always portable outside XSI-conformant systems. The 
> following form can
> be used instead:
> 
>         ( test expr1 && test expr2 ) || test expr3
> 
> _______________________________________________
> Libtool-patches mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/libtool-patches

-- 
Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  address@hidden



reply via email to

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