The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problems with a script that outputs data to a file joeribut Shell Programming and Scripting 1 10-30-2008 01:54 PM
Expect script with file input problems meberline Shell Programming and Scripting 1 05-29-2008 05:40 PM
Strange difference in file size when copying LARGE file.. 0ktalmagik Filesystems, Disks and Memory 1 06-03-2006 08:34 PM
Problems with Copying Directory brudnerx UNIX for Dummies Questions & Answers 3 01-12-2006 02:04 PM
copying files and Renaming them + shell script pathanjalireddy Shell Programming and Scripting 7 06-08-2005 05:08 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-29-2008
verdugan verdugan is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 4
Having problems copying a file from a script

Hello. Complete newbie over here, and I'm hoping you can help me out with this problem.
The script copies a file to a directory within my home dir.
Permissions are ok and the source file exists. If I execute the cp command from the command line or hardcode the path/file name, it works.


(lines ommited for readability)

Code:
 
fileName=$1
 
source="/p/cpt/validation/HS/cpt/models/"$fileName"/rtl/cpt/dangling/list.report"
destination="~/averdugo/CPT_FILES/"$fileName".txt"
cp $source $destination

I think the problem is with the fileName variable because when I execute the program with sh -x option, I see:


Code:
 
+ source=/p/cpt/validation/HS/cpt/models/v081023/rtl/cpt/dangling/list.report
+ destination=~/averdugo/CPT_FILES/v081023.txt
 
+ echo /p/cpt/validation/HS/cpt/models/v081023/rtl/cpt/dangling/list.report
/p/cpt/validation/HS/cpt/models/v081023/rtl/cpt/dangling/list.report
 
+ echo '~/averdugo/CPT_FILES/v081023.txt' 
~/averdugo/CPT_FILES/v081023.txt
 
+ cp /p/cpt/validation/HS/cpt/models/v081023/rtl/cpt/dangling/list.report '~/averdugo/CPT_FILES/v081023.txt'
 
cp: cannot create regular file `~/averdugo/CPT_FILES/v081023.txt': No such file or directory

As you can see from the statements above, there are single quotes around the destination variable '~/averdugo/CPT_FILES/v081023.txt' I have no idea where they came from.

All your help is much appreciated.

Angel
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0