The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Calling expect scripts from other expect scripts seva Shell Programming and Scripting 0 04-03-2008 10:45 AM
scripts please rrdore SUN Solaris 2 12-07-2006 01:35 AM
use of ssh in scripts esham Shell Programming and Scripting 7 11-16-2005 07:27 AM
Help with GDL to SQL scripts ch4r1e5 Shell Programming and Scripting 0 10-31-2005 01:51 PM
using su in scripts uchachra UNIX for Dummies Questions & Answers 3 03-11-2002 09:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-29-2007
Registered User
 

Join Date: Sep 2007
Posts: 82
Stumble this Post!
FTP Scripts

HI All

Need a help in FTP script

i need to ask the user to enter the source ftp server and password

and target ftp server and password , once it has logged in to the source server it need to go to directory and ftp to the target server

can anyone help me on this , Sample code is required

Thanks a lot

Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-29-2007
Registered User
 

Join Date: Sep 2007
Posts: 82
Stumble this Post!
Just wanted to be clear ,

When i run the Shell , it has to Prompt the User for host server :

echo "Please enter the host server:"
read IP
echo "Please enter the User id :"
read user
echo "Please enter the password :"
read pass
type = ''ascii''
$ftp
open $IP
quote USER $user
quote PASS $pass
$type

This wont work can anyone modify this and let me know , Thanks
Reply With Quote
  #3 (permalink)  
Old 11-29-2007
Registered User
 

Join Date: Sep 2007
Posts: 82
Stumble this Post!
Please help me on this
Reply With Quote
  #4 (permalink)  
Old 11-29-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Stumble this Post!
Use $HOME/.netrc then you ftp will do all the username/password for you.
Reply With Quote
  #5 (permalink)  
Old 11-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 82
Stumble this Post!
Hi

I tried to do that ,

can you please let me know

Just explaining the scenario

i am login to the Target server and asking the Source ftp server once it login just giving the directory name and get some files from source directory , is it possible , can you please give a sample code to fix this issue

Thanks
Reply With Quote
  #6 (permalink)  
Old 11-30-2007
encrypted's Avatar
Registered User
 

Join Date: Feb 2004
Location: Oslo, Norway
Posts: 218
Stumble this Post!
If you are thinking of ftp automation then as suggested by porter.
This may help
Reply With Quote
  #7 (permalink)  
Old 11-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 82
Stumble this Post!
Yes Thanks for the info :

But it is kind of critical in touching those files in my environment

I will post my code here , can you please let me know what went wrong here :

#!/bin/sh
echo " Please Enter the FTP Server Address :"
read FTP_SRVR
echo "Please Enter the User id :"
read FTP_USR
echo "Please enter the FTP Password :"
read FTP_PWD
ifile="/home/app/ins/seven/rem/"
ofile="/home/app/ins/six/ddf"
ftp <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
cd $ifile
lcd "$ofile"
mget *.*
bye
EOF
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0