1999-11-13 13:24:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
# Make sure touch can update the times on a file that is neither
|
|
|
|
|
# readable nor writable.
|
|
|
|
|
|
|
|
|
|
if test "$VERBOSE" = yes; then
|
|
|
|
|
set -x
|
|
|
|
|
touch --version
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
DEFAULT_SLEEP_SECONDS=2
|
|
|
|
|
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}
|
|
|
|
|
|
2002-06-15 08:03:24 +00:00
|
|
|
t1=no-rw1
|
|
|
|
|
t2=no-rw2
|
1999-11-13 13:24:54 +00:00
|
|
|
rm -rf $t1 $t2
|
|
|
|
|
: > $t1
|
|
|
|
|
|
|
|
|
|
# Make sure $t2 is two seconds newer than $t1.
|
2000-02-02 14:04:40 +00:00
|
|
|
echo sleeping for $SLEEP_SECONDS seconds...
|
1999-11-13 13:24:54 +00:00
|
|
|
sleep $SLEEP_SECONDS
|
|
|
|
|
: > $t2
|
|
|
|
|
fail=0
|
|
|
|
|
|
|
|
|
|
set x `ls -t $t1 $t2`
|
|
|
|
|
test "$*" = "x $t2 $t1" || fail=1
|
|
|
|
|
|
|
|
|
|
chmod 0 $t1
|
2000-11-27 08:01:57 +00:00
|
|
|
touch -d tomorrow -c $t1 || fail=1
|
1999-11-13 13:24:54 +00:00
|
|
|
|
|
|
|
|
set x `ls -t $t1 $t2`
|
|
|
|
|
test "$*" = "x $t1 $t2" || fail=1
|
|
|
|
|
|
1999-11-13 23:20:14 +00:00
|
|
|
# Also test the combination of --no-create and -a.
|
|
|
|
|
touch -a --no-create $t1 || fail=1
|
|
|
|
|
|
1999-11-13 13:24:54 +00:00
|
|
|
rm -f $t1 $t2
|
|
|
|
|
|
|
|
|
|
exit $fail
|