view move-if-change @ 39985:3a906538d254

(eshell/cat): Do a quick test if something is a regular file, before checking if it is a directory or symlink. This avoids a call to eshell-file-attributes, which can be expensive in some situations.
author John Wiegley <johnw@newartisans.com>
date Wed, 17 Oct 2001 02:00:20 +0000
parents 354e0c45cedf
children 14a97ab281d5
line wrap: on
line source

#!/bin/sh
if
test -r $2
then
if
cmp $1 $2 > /dev/null
then
echo $2 is unchanged
rm -f $1
else
mv -f $1 $2
fi
else
mv -f $1 $2
fi