bug-coreutils
[Top][All Lists]
Advanced

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

bug#22216: test, expr Operator Precedence and Associativity


From: Pádraig Brady
Subject: bug#22216: test, expr Operator Precedence and Associativity
Date: Tue, 22 Dec 2015 01:30:24 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 22/12/15 00:21, 積丹尼 Dan Jacobson wrote:
>>>>>> "EB" == Eric Blake <address@hidden> writes:
> 
> EB> On 12/21/2015 05:00 PM, 積丹尼 Dan Jacobson wrote:
>>> OK. Also make sure (info "(coreutils) test invocation") makes it clear that
>>> one cannot use
>>> test -f $1 -a $1 ! -ot $2 #and must use
>>> test -f $1 -a ! $1 -ot $2 #.
> 
> EB> Use of -a in test is inherently non-portable.  POSIX even says so -
> EB> there are some expressions which are completely ambiguous when you
> EB> attempt to use -a or -o.
> 
> Mmmm! The documentation should mention that!
> 
> EB> Also, your lack of quoting is a classic pitfall for how to incorrectly
> EB> use test.
> 
> EB> Better than what you typed would be using:
> 
> EB> test -f "$1" && test ! "$1" -ot "$2"
> 
> Mmmm, quote tips only mention in the case of (info "(coreutils) String 
> tests").
> Maybe need to mention in more places!

Patch V2 attached.

thanks,
Pádraig

Attachment: doc-test-logical-ops.patch
Description: Text Data


reply via email to

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