summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-06-29 10:45:31 +0200
committerJim Meyering <meyering@redhat.com>2012-06-30 11:00:32 +0200
commit5f6c22fceedd0d350e1a8246d4d73840de666c7e (patch)
treef9f1a5dbf0856d591f3d9fc103b2c3349f817710 /doc
parent5958bb44c4d7cf3b69bb62955b3ece9d0715eb60 (diff)
downloadcoreutils-5f6c22fceedd0d350e1a8246d4d73840de666c7e.tar.xz
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
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi4
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 08ef2d8c8..954a1f8f4 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -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