LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 01-05-2010, 09:33 AM   #1
davide123
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: Reputation: 16
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
 
Old 01-05-2010, 09:37 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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.
 
Old 01-05-2010, 09:51 AM   #3
davide123
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: Reputation: 16
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....
 
Old 01-05-2010, 10:00 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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.
 
Old 01-05-2010, 10:24 AM   #5
davide123
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: Reputation: 16
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
 
Old 01-05-2010, 10:28 AM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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
 
Old 01-05-2010, 10:32 AM   #7
davide123
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: Reputation: 16
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
 
Old 01-05-2010, 10:36 AM   #8
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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
 
Old 01-05-2010, 10:39 AM   #9
davide123
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: Reputation: 16
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
 
Old 01-05-2010, 10:41 AM   #10
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by davide123 View Post
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?
 
Old 01-05-2010, 10:55 AM   #11
davide123
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: Reputation: 16
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.
 
Old 01-05-2010, 12:53 PM   #12
davide123
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: Reputation: 16
think i was able to solve the issue using this instead

Code:
yes| cp -LRuvpf /mnt/file /mnt/usbdrive/file > /error.log 2>&1
 
Old 01-05-2010, 01:09 PM   #13
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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
 
Old 01-05-2010, 01:16 PM   #14
davide123
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: Reputation: 16
i have seen around on the www that this is a bug with coreutils
 
Old 01-05-2010, 03:14 PM   #15
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Quote:
Originally Posted by GrapefruiTgirl View Post
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
Code:
type cp
should tell you if cp is actually aliased.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cp --reply=yes deprecated!! fredsub Linux - General 1 08-25-2008 09:43 PM
Non-deprecated version of cp --reply=no punt Linux - General 4 07-03-2007 06:04 AM
Subscribe to thread option on Quick Reply Matir LQ Suggestions & Feedback 6 02-15-2006 06:48 PM
sshd: Deprecated option ReverseMappingCheck kalahari875 Linux - Security 3 01-06-2005 08:10 PM
post reply & submit reply buttons annehoog LQ Suggestions & Feedback 10 01-05-2004 06:43 PM


All times are GMT -5. The time now is 10:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration