[Top][All Lists]

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

Re: RFC: cp -if a b: should it prompt? POSIX says `yes', most don't

From: Adrian
Subject: Re: RFC: cp -if a b: should it prompt? POSIX says `yes', most don't
Date: Wed, 09 Mar 2005 13:12:38 +0100

Hi. I found the following thread on the "cp -if" problem:


which also refers to the discussion at:


Recently I upgraded to FedoraCore3, and I saw that my "cp -f" commands,
when launched as root, now ask me for confirmation (they didn't in the

  # cp -f a b
  cp: ¿overwrite «b»? (y/n)

This happens because old redhat patch is not used any more, as Tim Waugh

> This is POSIX territory.  We *used* to patch cp so that -f also had
> the effect that --reply=yes now does, because at the time the latter
> option did not exist.

Jim Meyering also commented that in the first mentioned thread:

> Note that RedHat has been using a patch that makes cp's behavior
> non-POSIX, yet consistent with that of most other systems, for years.

I've seen that the behaviour only occurs with root because it has an

  # alias cp
  alias cp='cp -i'

So the "cp -f" if equivalent to "cp -i -f". This is what Paul Eggert 

> The main motivation here, I think, is that if you have an alias like
> this:
> alias cp cp -i
> then "cp -f" should cancel the -i.  This alias is (or was) common for
> root on Red Hat systems.

I think I'll define a new default alias for root, for example:

  # alias cpf='cp -f'

in order to have a short alternative to the long "cp --reply=yes", that 
I commented here:

> Hmmm, the new option looks a bit long:
>   cp --reply=yes ...
> Let me make a suggestion. What about patching cp so that -y assumes
> "yes" in all questions?
>   cp -y ...
> The -y option is used in many commands, and I suppose it would be
> useful for cp too.

What's your opinion about adding a -y option to assume "yes" in all


reply via email to

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