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: 積丹尼 Dan Jacobson
Subject: bug#22216: test, expr Operator Precedence and Associativity
Date: Tue, 22 Dec 2015 08:21:16 +0800

>>>>> "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!

Also no "X$1" = X special tip seen...





reply via email to

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