Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-30-2006, 06:30 AM   #1
LQ Newbie
Registered: Nov 2006
Posts: 10

Rep: Reputation: 0
Unhappy cp command problem in script


I have som problem in using cp command in shell script. Please see the followoing script,

#!/bin/sh -f

 echo $dir_temp

 mkdir $dir_temp

        cd /ppscdr/cdrp2p/temp
        cp /ppscdr/cdrp2p/temp/${dir_temp}*.unl /ppscdr/cdrp2p/${dir_temp}
It gives following error,

[root@cdrwebserver cdrp2p]# ./
cp: cannot stat `/ppscdr/cdrp2p/temp/20061105*.unl': No such file or directory
please give me some help to find the error.
Old 11-30-2006, 06:44 AM   #2
Senior Member
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
perhaps you need a / between ${dir_temp} and *.unl:
cp /ppscdr/cdrp2p/temp/${dir_temp}/*.unl /ppscdr/cdrp2p/${dir_temp}
Old 11-30-2006, 03:37 PM   #3
LQ Newbie
Registered: Nov 2006
Posts: 10

Original Poster
Rep: Reputation: 0
no this ${dir_temp}*.unl mean the file need to copy.
Old 11-30-2006, 05:39 PM   #4
Senior Member
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
#!/bin/sh -f

to this:

And this:
cp /ppscdr/cdrp2p/temp/${dir_temp}*.unl /ppscdr/cdrp2p/${dir_temp}

to this:
cp -r /ppscdr/cdrp2p/temp/${dir_temp}*.unl /ppscdr/cdrp2p/${dir_temp}


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
Problem executing mv command inside shell script pablogosse Linux - General 7 12-16-2009 01:21 PM
Shell-script should control a piped command -> PROBLEM waldese Linux - General 8 09-29-2006 04:27 AM
Problem with perl script using a variable from a unix command. abefroman Programming 1 05-11-2006 06:11 PM
Problem with shell script using a variable from a unix command. abefroman Programming 1 05-10-2006 03:14 PM
problem with find command in script cojo Linux - Software 3 05-26-2004 11:28 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:24 AM.

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