|Comparing and Merging Files with GNU diff and patch|
by David MacKenzie, Paul Eggert, and Richard Stallman
Paperback (6"x9"), 120 pages
RRP £12.95 ($19.95)
"Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>>
10.9 Backup File Names
patch renames an original input file into a backup
file by appending to its name the extension ‘.orig’, or ‘~’
if using ‘.orig’ would make the backup file name too
-z backup-suffix or
--suffix=backup-suffix option causes
use backup-suffix as the backup extension instead.
Alternately, you can specify the extension for backup files with the
SIMPLE_BACKUP_SUFFIX environment variable, which the options
patch can also create numbered backup files the way GNU Emacs
does. With this method, instead of having a single backup of each file,
patch makes a new backup file name each time it patches a file.
For example, the backups of a file named ‘sink’ would be called,
successively, ‘sink.~1~’, ‘sink.~2~’, ‘sink.~3~’, etc.
-V backup-style or
--version-control=backup-style option takes as an
argument a method for creating backup file names. You can alternately
control the type of backups that
patch makes with the
PATCH_VERSION_CONTROL environment variable, which the
-V option overrides. If
PATCH_VERSION_CONTROL is not
VERSION_CONTROL environment variable is used instead.
Please note that these options and variables control backup file
names; they do not affect the choice of revision control system
(see section 10.2 Revision Control).
The values of these environment variables and the argument to the
-V option are like the GNU Emacs
variable (see section `Backup Names' in The GNU Emacs Manual,
for more information on backup versions in Emacs). They also
recognize synonyms that are more descriptive. The valid values are
listed below; unique abbreviations are acceptable.
- Always make numbered backups.
- Make numbered backups of files that already have them, simple backups of the others. This is the default.
- Always make simple backups.
You can also tell
patch to prepend a prefix, such as a
directory name, to produce backup file names. The
--prefix=prefix option makes backup
files by prepending prefix to them. The
prefix to the last file name component of backup file names
instead; for example,
-Y ~ causes the backup name for
‘dir/file.c’ to be ‘dir/~file.c’. If you use either of
these prefix options, the suffix-based options are ignored.
If you specify the output file with the
-o option, that file is
the one that is backed up, not the input file.
Options that affect the names of backup files do not affect whether
backups are made. For example, if you specify the
--no-backup-if-mismatch option, none of the options described
in this section have any affect, because no backups are made.
|ISBN 0954161750||Comparing and Merging Files with GNU diff and patch||See the print edition|