#!/bin/sh #\- copy file; if destination file exists, back it up before copy #usage: %cpr-save srcfilepath destfilepath #check if destfile exists at destfilepath #if true, then rename destfile=destfile.old, #then copy srcfile to destfile, with attributes presserved # if [ $# -ne 2 ] then exit 1 fi if [ -e $2 ] then /bin/mv $2 $2.old /bin/echo renamed $2 $2.old fi /bin/cp -p $1 $2 /bin/echo copied $1 to $2