Hi, How can i copy a file to another with the same name without being prompted for a confirmation ? I read the cp man page, but nada. Any help would be appreciated. Warm Regards, M?rio Gamito
> How can i copy a file to another with the same name without being > prompted for a confirmation ?-f should allow you to do this. For root, cp is aliased to cp -i, so you can either set the alias the way you want, or you can do '\cp foo bar' without the ticks, which tells the system to ignore the alias for the command.> Any help would be appreciated.No applause, just throw money. :-P -- During times of universal deceit, telling the truth becomes a revolutionary act. George Orwell
Hi, Jim Perrin wrote:> -f should allow you to do this. For root, cp is aliased to cp -i, so > you can either set the alias the way you want, or you can do '\cp foo > bar' without the ticks, which tells the system to ignore the alias > for the command.It doesn't work. I already tried that before posting.>> Any help would be appreciated. > > No applause, just throw money. :-PAh, ah... you don't deserve it :) LOL :) Regards, M?rio Gamito
M?rio Gamito wrote:> Hi, > > How can i copy a file to another with the same name without being > prompted for a confirmation ? > > I read the cp man page, but nada.Enter the command 'alias' to see why this happens unexpectedly. -- Les Mikesell lesmikesell at gmail.com
M?rio Gamito wrote:> Hi, > > How can i copy a file to another with the same name without being > prompted for a confirmation ? > > I read the cp man page, but nada.1. # /bin/cp foo bar 2. # cp -f foo bar 3. # \cp foo bar 4. # unalias cp # cp foo bar ...
> 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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Mar 02, 2007 at 08:09:29PM +0000, M?rio Gamito wrote:> Hi, > > How can i copy a file to another with the same name without being > prompted for a confirmation ? > > I read the cp man page, but nada. > > Any help would be appreciated.I have seen a lot of sensible advice, but you reported none worked, which is odd. Just for the sake of curiority, what is the output of: # type cp ? []s - -- Rodrigo Barbosa "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFF6l85pdyWzQ5b5ckRAhyCAKCDVvOLxCF7sVLt4DxV5mwV46XqqgCghSHM 3xcG7jVKnhWSEattThGSIQI=h/kY -----END PGP SIGNATURE-----
Try this: \cp from to IIRC, cp is an alias that translates to cp -i, I believe rm and mv are the same. Entering the leading \ overrides the alias. Hope that helps. Happy trails, Merv -----Original Message----- From: Mike McCarty [mailto:Mike.McCarty at sbcglobal.net] Sent: Monday, March 05, 2007 6:06 PM To: CentOS mailing list Subject: Re: [CentOS] Lame question about cp Paul Krash wrote:> Mario (?) wrote: > > >>How can i copy a file to another with the same name without being >>prompted for a confirmation, and -f doesn't work? > > > Unalias cp doesn't work....hmmm.How about $ which cp He may have some script sth. Mike -- p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);} Oppose globalization and One World Governments like the UN. This message made from 100% recycled bits. You have found the bank of Larn. I can explain it for you, but I can't understand it for you. I speak only for myself, and I am unanimous in that! _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified. --------------------------------------------------------------------- Astrium Limited, Registered in England and Wales No. 2449259 Registered Office: Gunnels Wood Road, Stevenage, Hertfordshire, SG1 2AS, England