Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
01-05-2010, 09:33 AM
|
#1
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Rep:
|
cp the reply option is deprecated try using i or f instead
my command is the following:
cp -LRuvp --reply=yes /mnt/filename /mnt/usbdrive/filename 2>/mnt/usbdrive/error.log
i get "the reply option is deprecated try using i or f instead"
the problem with the above is the only thing i get in my error log is: "the reply option is deprecated try using i or f instead"
and if i use "i , f , /cp , etc..." nothing is generated in my log...
what i want to do is copy file from source with "LRuvp" to destination and appened out put to "error.log"
please help!
thanks
david 
|
|
|
01-05-2010, 09:37 AM
|
#2
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Not sure I 100% understand what the deal is with the --reply option, as I've never used it. However, by directing 2> to the log, you're only catching errors; you're neglecting to catch "non-errors".
try the following and see if it helps:
Code:
cp -LRuvp --reply=yes /mnt/filename /mnt/usbdrive/filename >> /mnt/usbdrive/error.log 2>&1
That should direct stderr into stdout, and then stdout into the logfile.
Sasha
EDIT Since you mentioned you want to APPEND the output, I changed the > to >>
Last edited by GrapefruiTgirl; 01-05-2010 at 09:38 AM.
|
|
|
01-05-2010, 09:51 AM
|
#3
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
the reply option is because i am using -u so it asks me if i want to overwrite a existing file, i need --reply=yes as this issue is part of a shell backup script loaded into cron to run @ 8pm every night. i cant hit enter every time it prompts me to overwrite the file...
with this first cp command i want to create the error log >/mnt/usbdrive/error.log and with the next commands in script i append there output to the same file>>/mnt/usbdrive/error.log
when i try cp -LRuvp --reply=yes /mnt/filename /mnt/usbdrive/filename >> /mnt/usbdrive/error.log 2>&1 OR cp -LRuvp --reply=yes /mnt/filename /mnt/usbdrive/filename > /mnt/usbdrive/error.log 2>&1
I still get the reply option is deprecated as the only output in my logfile
thanks....
|
|
|
01-05-2010, 10:00 AM
|
#4
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Hmm.. OK, have you tried my example, with the redirects as I showed, AND used the -i option instead of the --reply=yes option as it implies you should?
Seems logical that that should work. I've made lots of similar scripts and have had no trouble getting the output to go to the log file.
Is the cp command aborting when it finds the --reply option? Or maybe, is there actually stuff to copy? If there's not (because maybe everything's already up-to-date) then that's why no output is being generated: there's nothing to copy.
|
|
|
01-05-2010, 10:24 AM
|
#5
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
if i try how you suggest, in my error log i get the "cp: overwrite /mnt/file/***** ?'
this is why i need to have reply=yes in my command, however having the reply=yes, i only get "the reply option is deprecated" which brings me back to my dilema.....
thanks
|
|
|
01-05-2010, 10:28 AM
|
#6
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
OK, my apology if I'm missing something and making this harder than it should be
So.. I assume you are using the --reply=yes option so you don't have to press ENTER all the time. If that's the case, use the -f option instead. You won't be asked about every file, and the -u option will copy only files that have changed.
Options I would use typically for such an application, are -Rfuvp (and you add the -L option as you wish).
Sasha
|
|
|
01-05-2010, 10:32 AM
|
#7
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
lol no problem just trying to solve this issue has been racking my brain for a while.....
i have tried "i" and "f" as you suggest but with both options it still prompts to overwrite in my error log....
 david
|
|
|
01-05-2010, 10:36 AM
|
#8
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Weird, I don't get it  ..
Without the -i option, and without the --reply option, but WITH the -f option, it should not be asking you *anything* -- it should just DO it..
Something's amiss, and I'm afraid I don't see it. I'll update again (or someone else will) if I/they can see what's wrong here.
Sasha
|
|
|
01-05-2010, 10:39 AM
|
#9
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
thats is correct, doing it exactly as u say above without "i" or "reply=yes" it prompts me for the overwrite in my error log and wont move forward...
please let me know when you find out something, much appreciated....
david
|
|
|
01-05-2010, 10:41 AM
|
#10
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Quote:
Originally Posted by davide123
thats is correct, doing it exactly as u say above without "i" or "reply=yes" it prompts me for the overwrite in my error log and wont move forward...
please let me know when you find out something, much appreciated....
david
|
OK, and just for absolute clarity, you ARE using the -f option, yes?
|
|
|
01-05-2010, 10:55 AM
|
#11
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
correct the command is now:
cp -LRuvpf /mnt/filename /mnt/usbdrive/filename >> /mnt/usbdrive/error.log 2>&1
then i check my error log...
it says "cp: overwrite /mnt/usbdrive/filename.file ?"
however when i hit ctrl-z to stop the command i see "cp -i -LRuvpf" and i never put in the "i"
i cant get it to not insert the "i" im not sure why its being automatically inserted, and the reason i can tell its there is when i hit ctrl-z it shows "cp -i -LRuvpf" instead of "cp -LRuvpf" -how i typed it
Last edited by davide123; 01-05-2010 at 11:40 AM.
|
|
|
01-05-2010, 12:53 PM
|
#12
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
think i was able to solve the issue using this instead
Code:
yes| cp -LRuvpf /mnt/file /mnt/usbdrive/file > /error.log 2>&1
|
|
|
01-05-2010, 01:09 PM
|
#13
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
 That's cool! Nice. But I *still* don't understand WHY it's asking you anything at all  ..... Odd. I hope someone sheds light on this!
Sasha
|
|
|
01-05-2010, 01:16 PM
|
#14
|
Member
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102
Original Poster
Rep:
|
i have seen around on the www that this is a bug with coreutils
|
|
|
01-05-2010, 03:14 PM
|
#15
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by GrapefruiTgirl
 That's cool! Nice. But I *still* don't understand WHY it's asking you anything at all  ..... Odd. I hope someone sheds light on this!
Sasha
|
Maybe cp is aliased to 'cp -i' (I remember in old unix machines this was a default or just an habit of system administrators - I don't know exactly). Davide, the command
should tell you if cp is actually aliased.
|
|
|
All times are GMT -5. The time now is 01:07 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|