Red Hat Bugzilla – Bug 150558
cp -f (force copy) asks for confirmation
Last modified: 2007-11-30 17:11:01 EST
Description of problem:
As root, if you run "cp -f file1 file2" and file2 exists, the command
asks for confirmation: "cp: Overwrite ï¿½file2ï¿½? (y/n)".
The "-f" option should omit the confirmation request.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. su -
2. touch file1 file2
3. cp -f file1 file2
Actual Results: I'm asked for confirmation:
cp: Overwrite ï¿½file2ï¿½? (y/n)
Expected Results: Confirmation shouldn't appear.
coreutils-5.2.1-31 (comes with the distribution)
There are no update available in the updates-released repository.
No, that's not what the -f option is for. Use --reply=yes to omit confirmation
Sure? I've always used -f option to avoid the question.
Running "cp --help" I obtain:
-f, --force borra los destinos que ya existan, sin preguntar
-f, --force deletes existing destinations, without asking
Maybe a recent change in the functionality of cp?
Yes, I'm sure -- and if that's what cp --help really says then the
translation is incorrect.
Here is the original:
-f, --force if an existing destination file cannot be
opened, remove it and try again
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.
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.
It's better to have fewer patches in our packages -- we already patch coreutils
Feel free to suggest this on the bug-coreutils mailing list.