GNU bug report logs -
#11809
document "So how do we just simply make a backup file?"
Previous Next
Reported by: jidanni <at> jidanni.org
Date: Thu, 28 Jun 2012 15:36:02 UTC
Severity: normal
Tags: fixed
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #26 received at 11809 <at> debbugs.gnu.org (full text, mbox):
Bernhard Voelker wrote:
> On 06/29/2012 10:48 AM, Jim Meyering wrote:
>> Here's the doc patch I suggested, but I'll hold off for now.
>> I'd like to hear if anyone thinks it's worth adding a new option,
>> which would obviate such a script.
>
> I think it's okay, that special backup case is described in the info
> page of cp twice anyway.
>
>> diff --git a/doc/coreutils.texi b/doc/coreutils.texi
>> index 08ef2d8..5207c44 100644
>> --- a/doc/coreutils.texi
>> +++ b/doc/coreutils.texi
>> @@ -7675,9 +7675,11 @@ cp invocation
>> #!/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 -- "$i" "$i" || fail=1
>> done
>> +exit $fail
>> @end example
>>
>> @item --copy-contents
>
> When we speak of "backup", then maybe "--preserve=all" would be nice.
>
> BTW: that special backup case accepts -a which includes both -d and -R
> which both are maybe not ideal if you speak about a backup of a regular
> file. The former treats symlinks specially, and the latter is designed
> to recurse into directories - both may be misleading (although -d may
> make some sense in certain situation when creating a backup of a
> symlink). WDYT?
Adding --preserve=all sounds like a good idea.
Thanks.
Allowing this little script to work also for non-regular files
seems like it'd be useful, too. But it's beginning to look as if
this combination of options is both useful and involved enough that
the functionality should be provided by a new --only-backup option.
This bug report was last modified 6 years and 279 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.