Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-06-2009
Registered User
 

Join Date: Jan 2008
Posts: 75
FTP question

HI
In my script its like this

------------
echo "Enter filename"
read fname

ftp -v -n abcd.efh.kk.com << EOF
user userid pwd
bin
mget $fname.tar--not working if i give "$fname", works only as "demo.tar"
bye
------------

My target is to get a $fname.tar from a remote host.How ever ftp is not recognizing that unless i give the exact filename itself.Is there any work around to get that file from that remote host.

Appreciate your help.
Sponsored Links
  #2 (permalink)  
Old 08-06-2009
BubbaJoe's Avatar
Registered User
 

Join Date: Oct 2008
Location: St Louis
Posts: 154
change


Code:
mget $fname.tar

to


Code:
mget ${fname}.tar

  #3 (permalink)  
Old 08-06-2009
scottn's Avatar
scottn scottn is online now Forum Staff  
Moderator
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,859
Hi.

I presume there is a closing EOF?

When you typed in the name, did you type demo, or demo.tar?

Can you post the error?


edit:
Quote:
I presume there is a closing EOF?
what a silly question!

Last edited by scottn; 08-06-2009 at 05:05 PM..
  #4 (permalink)  
Old 08-06-2009
Registered User
 

Join Date: Jan 2008
Posts: 75
BubbaJoe--Thanks

Scott--Valid point...Yes it has EOF at the end..



echo "Enter filename"
read fname
ftp -v -n abcd.efh.kk.com << EOF
user userid pwd
bin
mget $fname.tar--not working if i give "$fname", works only as "demo.tar"
bye
EOF
  #5 (permalink)  
Old 08-06-2009
scottn's Avatar
scottn scottn is online now Forum Staff  
Moderator
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,859
!!

I know it does (that's why it was a silly question), otherwise it wouldn't work at all!

As for the { } around the variable, it's interesting that that should make a difference, because in "normal shell", it would not be nessessary.
Sponsored Links
Closed Thread

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 Off




All times are GMT -4. The time now is 07:59 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-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0