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 #.

Use of -a in test is inherently non-portable.  POSIX even says so -
there are some expressions which are completely ambiguous when you
attempt to use -a or -o.

Also, your lack of quoting is a classic pitfall for how to incorrectly
use test.

Better than what you typed would be using:

test -f "$1" && test ! "$1" -ot "$2"

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to