view move-if-change @ 110314:405e3949f580

* lisp/subr.el (y-or-n-p): New function, moved from src/fns.c. Use read-key. * src/fns.c (Fy_or_n_p): Move to lisp/subr.el. (syms_of_fns): Don't defsubr Sy_or_n_p. * src/lisp.h: Don't declare Fy_or_n_p. * src/fileio.c (barf_or_query_if_file_exists): Fy_or_n_p -> y-or-n-p.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 12 Sep 2010 16:35:37 +0200
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