LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   &abcd& - directory (https://www.linuxquestions.org/questions/programming-9/and-abcd-and-directory-660985/)

tostay2003 08-06-2008 04:52 PM

&abcd& - directory
 
In my script, I am trying to issue a cp command.

The file within &abcd& directory has to be copied to another location
Quote:

ie. File1.txt in /var/official/'&abcd&' has to be copied to
File2.txt in /otherlocation/File2.txt
I have the code as follows

Code:

cp "/var/official/'\&abcd\&'/File1.txt    /otherlocation/File2.txt"
But I get error as below

Quote:

cp: Insufficient arguments (1)
Usage: cp [-f] [-i] [-p] [-@] f1 f2
cp [-f] [-i] [-p] [-@] f1 ... fn d1
cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] d1 ... dn-1 dn
I guess I am using proper escape characters. But it isnt' working.

matthewg42 08-06-2008 05:11 PM

how about
Code:

cp '/var/official/&abcd&/File1.txt' '/otherlocation/File2.txt'

tostay2003 08-06-2008 05:36 PM

Thanks it was working.

I was using shell variables and got confused with single quotes in process

burschik 08-07-2008 01:01 AM

Quote:

Originally Posted by tostay2003 (Post 3239185)
Thanks it was working.

I was using shell variables and got confused with single quotes in process

No, you got confused about double quotes.


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