3 #=======================================================================
5 # File ID: ed0eac02-5d3f-11df-9313-90e6ba3022ac
6 # I’m getting spoiled by having a text-base around when working in
7 # Subversion, CVS doesn’t have that. So if I’ve edited a file without
8 # making a copy of the original, a new version of the file has to be
9 # checked out manually. This script automates that task.
10 #=======================================================================
16 if [ "$fname" = "" ]; then
17 echo "Syntax: $0 filename" >&2
22 echo -n "$0: $fbck: File already exists. Press Enter to remove it, Ctrl-C to abort..." >&2
24 rm -v $fbck ||
{ echo "$0: $fbck: Cannot remove file" >&2; exit 1; }
28 echo "$0: $ftmp: Temporary file already exists" >&2
32 if [ ! -f $fname ]; then
33 echo "$0: $fname: Not a regular file" >&2
37 mv -v $fname $ftmp ||
{ echo "$0: mv $fname $ftmp: Error when renaming to tempfile" >&2; exit 1; }
40 if [ ! -e $fname ]; then
41 echo "$0: $fname: Yikes! Couldn’t check out original file, moving tempfile back" >&2
42 mv -v $ftmp $fname ||
{ echo "$0: mv $ftmp $fname: Shit! Unable to rename tempfile to workfile" >&2; }
46 mv -v $fname $fbck ||
{ echo "$0: mv $fname $fbck: Couldn’t rename to backup file" >&2; exit 1; }
47 mv -v $ftmp $fname ||
{ echo "$0: mv $ftmp $fname: Couldn’t rename tempfile to workfile" >&2; exit 1; }