view move-if-change @ 44419:16b3622178f9

update-game-score.c (SCORE_FILE_PREFIX): Don't hardcode. (get_user_id): Take struct passwd as an argument. (get_home_dir): New function. (main): Read in user information here. Discover home directory if necessary. (read_score): Trim newline only in `getline' case.
author Colin Walters <walters@gnu.org>
date Sun, 07 Apr 2002 05:46:03 +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