[CentOS] Lame question about cp

Sat Mar 3 10:52:50 UTC 2007
dan1 <dan1 at edenpics.com>

> Hi,
> How can i copy a file to another with the same name without being prompted 
> for a confirmation ?

Hello, Mario.

Type this:
# alias
This should show you the current alias for the cp command.
I personnally have this:
alias cp='cp -i'

The -i option requires the user confirmation for each copied file. This is 
for safety concerns.
Therefore, if this is also your case, you need to add the --reply=yes option 
so that it automatically answers yes to all questions.
Therefore you would type:
cp --reply=yes ./myfile ./myfile2
and if myfile2 existed it shouldn't ask any confirmation.
However, this '-i' cp alias command should only be there for any user shell 
(even root), but should not be there for any cron script or use outside of a 
shell command, so the -f would be sufficient in this case.

However, putting 'unalias cp', and then 'cp -f' should do in your case also, 
and I don't understand why it doesn't..

Hope it helps.