Re: cp/mv: add -n option to not overwrite target (Ubuntu bug #229182)
From:
Jim Meyering
Subject:
Re: cp/mv: add -n option to not overwrite target (Ubuntu bug #229182)
Date:
Wed, 07 Jan 2009 08:35:24 +0100
Kamil Dudka <address@hidden> wrote:
> On Tuesday 06 January 2009 17:32:59 Kamil Dudka wrote:
>> On Tuesday 06 January 2009 16:50:19 you wrote:
>> > A couple of tweaks needed I think:
>> >
>> > a
>> > The @option{-i} option overrides previous @option{-n} option
>> > ^
>> > Same tweak suggested for both the cp usage() function.
>> >
>> > In the tests you set LC_ALL=C explicitly.
>> > I don't think this is necessary as the locale
>> > is set to C by default (using the tests/lang-default script).
>>
>> Ok, thanks. Attaching new version of patch.
>>
>>
>> Kamil
> Sorry for typo in documentation. Fixed patch attached.
Thanks for working on this.
Have you considered other long-option names?
I prefer --no-clobber. or maybe --no-overwrite
-----------------------
Please adjust the NEWS entry:
- cp/mv new option -n to not overwrite target
+ cp and mv accept a new option, --LONG_OPTION (-n): silently refrain
+ from overwriting any existing destination file
-----------------------------
You haven't mentioned how this new option interacts with --backup,
another option that prevents loss of any existing destination file.
Since with --backup, cp and mv arrange to move any destination aside,
one might expect -n --backup to be equivalent to --backup.
-------------------
In mv documentation (--help and texi), please say something like:
If you specify more than one of the -i,-f,-n options, only the
final one takes effect.
That's easier to understand than
-i overrides preceding -f or -n
-n overrides preceding -i or -f
-f overrides preceding -i or -n