LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-02-2013, 05:43 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 255

Rep: Reputation: Disabled
cp: missing file operand


Why cp: missing file operand? What "cp" parameter i need to add or whats wrong please?

domlistexp=domlistexp
domlistexp_bak=domlistexp_bak
touch $domlistexp
rm -rf $domlistexp_bak
cp $domlistexp $domlistexp_bak

output:
+ rm -rf domlist_bak
+ cp
cp: missing file operand
Try `cp --help' for more information.
 
Old 12-02-2013, 05:50 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,489

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Check carefully the names of the variables. The line
Code:
+ cp
tells us that the variables domlistexp and domlistexp_bak are empty. Moreover, the output you have shown doesn't match the lines of code posted above: the line
Code:
+ rm -rf domlist_bak
should be
Code:
+ rm -rf domlistexp_bak
instead.
 
Old 12-02-2013, 05:55 AM   #3
postcd
Member
 
Registered: Oct 2013
Posts: 255

Original Poster
Rep: Reputation: Disabled
colucix, no i think it should not.

sed /^\$domain$/d $domlist_bak > $domlist;rm -rf $domlist_bak
cp $domlistexp $domlistexp_bak

i think its correct and that is the place where the cp: error happening..? so error is in: cp $domlistexp $domlistexp_bak command?

Last edited by postcd; 12-02-2013 at 05:57 AM.
 
Old 12-02-2013, 09:58 AM   #4
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,747

Rep: Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977
Quote:
Originally Posted by postcd View Post
colucix, no i think it should not.

sed /^\$domain$/d $domlist_bak > $domlist;rm -rf $domlist_bak
cp $domlistexp $domlistexp_bak

i think its correct and that is the place where the cp: error happening..? so error is in: cp $domlistexp $domlistexp_bak command?
He's saying your variable names are wrong, and the code you posted does not match the output you posted. Therefore you messed something up in copying things into your post, which, since the likely cause is a typo, makes it impossible to diagnose the problem.

Code:
domlistexp_bak=domlistexp_bak
rm -rf $domlistexp_bak
will NOT expand to
Code:
+ rm -rf domlist_bak
Which means you did not post your actual code or output, and we can do nothing to help you.

As colucix said,
Code:
+ cp
indicates that your variables $domlistexp $domlistexp_bak being used in the cp command (or whatever you ARE using, since we've already established there's a discrepancy here) are not expanding, they're empty variables. This likely points to a typo in the code that you did not post here.

Last edited by suicidaleggroll; 12-02-2013 at 10:00 AM.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chown giving operand missing error Jhinukk Linux - General 1 06-25-2012 04:45 AM
MailScanner: chown: missing operand after `postfix' chengli Linux - Server 1 01-14-2012 11:04 AM
[SOLVED] acroread gives me dirname:missing operand slackingclement Slackware 2 07-03-2011 08:24 AM
Error message "dirname: missing operand" when starting acroread thethinker Slackware 2 08-19-2010 09:49 AM
Error in building world: warning: operand 1 missing mode? henkelarsson12 *BSD 0 04-14-2006 02:14 PM


All times are GMT -5. The time now is 05:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration