doc: improve sample backup script

* doc/coreutils.texi (cp invocation): Make the backup script exit
with an accurate reflection of any failure.
Also, add --preserve=all.

Improved-by: Bernhard Voelker
This commit is contained in:
Jim Meyering committed 2012-06-30 11:00:32 +02:00
1 parent 5958bb44c4
commit 5f6c22fcee
1 file changed
+3 -1
+3 -1
View File
@@ -7675,9 +7675,11 @@ combination of options is this tiny Bourne shell script:
#!/bin/sh
# Usage: backup FILE...
# Create a @sc{gnu}-style backup of each listed FILE.
fail=0
for i; do
cp --backup --force -- "$i" "$i"
cp --backup --force --preserve=all -- "$i" "$i" || fail=1
done
exit $fail
@end example
@item --copy-contents