if [[ ! -f a && ! -f b ]];then
echo a and b don\'t exist
elif [[ -f a && ! -f b ]];then
echo b doesn\'t exist
elif [[ ! -f a && -f b ]];then
echo a doesn\'t exist
elif [[ -f a && -f b ]];then
if [[ ! a -nt b && ! a -ot b ]];then
echo mtime of a and b equals
elif [ a -ot b ];then
echo a older than b
else
echo a newer than b
fi
fi
rm a b > /dev/null 2>&1
./compare.sh
touch a
./compare.sh
rm a
touch b
./compare.sh
touch a
cp -p a b
./compare.sh
touch a
sleep 1
touch b
./compare.sh
touch b
sleep 1
touch a
./compare.sh
$ ./test_compare.sh
a and b don't exist
b doesn't exist
a doesn't exist
mtime of a and b equals
a older than b
a newer than b