mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
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:
1 parent
5958bb44c4
commit
5f6c22fcee
1 file changed
+3
-1
+3
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user