Re: Lame question about cp

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



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.
Daniel

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux