[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp/mv: add -n option to not overwrite target (Ubuntu bug #229182)

From: Eric Blake
Subject: Re: cp/mv: add -n option to not overwrite target (Ubuntu bug #229182)
Date: Wed, 07 Jan 2009 20:06:53 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20081209 Thunderbird/ Mnenhy/

Hash: SHA1

According to Jim Meyering on 1/7/2009 12:27 PM:
>>> Anyone else have a preference?
>> Now the option is --no-clobber in attached patch. Anyway the change is
>> trivial. No problem to change it if there will be a consensus
>> for --no-overwrite or something else.
> Thanks!  Almost done, I think.
> Unless anyone pipes up about the choice of long option name.

I like --no-clobber, particularly since it is similar to the bash (and
tcsh) noclobber shell option.

> What do you think about making cp/mv fail if -n and --backup are used 
> together?
> Then there would be no risk of misunderstanding.

Seems reasonable to me.

> +++ b/NEWS
> @@ -4,6 +4,9 @@ GNU coreutils NEWS
- -*- outline -*-
>  ** New features
> +  cp and mv accept a new option, --no-clobber (-n): silently refrain
> +  from overwriting any existing destination file

Missing period.

> +                                 opened, remove it and try again (The
- -f option\n\
> +                                 is redundant if the -n option is used.)\n\
> +  -i, --interactive            prompt before overwrite  (The -i option\n\
> +                                 overrides a previous -n option.)\n\
>    -H                           follow command-line symbolic links in
>  "), stdout);
>        fputs (_("\
> @@ -176,6 +179,8 @@ Mandatory arguments to long options are mandatory
for short options too.\n\
>    -L, --dereference            always follow symbolic links in SOURCE\n\
>  "), stdout);
>        fputs (_("\
> +  -n, --no-clobber             do not overwrite an existing file  (The
- -n\n\
> +                                 option overrides a previous -i option.)\n\

The formatting is not very consistent here (are these full sentences, with
capitalization, periods, and two spaces, or just phrases?)

> +     case 'n':
> +       x.interactive = I_ALWAYS_NO;
> +       break;

Does this actually do the right thing, or does it only prevent overwrites
at spots where, without arguments, a prompt would be issued?  In other
words, is this particular implementation reinventing the same problems as
the deprecated --reply=no?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]