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
shell script command lg123 UNIX and Linux Applications 3 04-11-2008 12:35 AM
cd command is not working in my shell script amitrajvarma Shell Programming and Scripting 3 10-03-2007 02:04 AM
how to use cd command in shell script LAKSHMI NARAYAN Shell Programming and Scripting 3 09-09-2007 03:04 AM
vi command in shell script bryan UNIX for Dummies Questions & Answers 2 05-23-2006 04:51 PM
Shell script command dipanrc Shell Programming and Scripting 7 11-29-2005 07:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Nov 2007
Posts: 52
Stumble this Post!
Use ftp command in shell script

How can i use FTP Command in a shell script ?

user='user1'
password='password1'
IP='***.***.***.***'

ftp -n $IP 22 <<END_SCRIPT
user $user $password
exit
END_SCRIPT
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Nov 2007
Location: Belgium & France
Posts: 70
Stumble this Post!
See the .netrc
Reply With Quote
  #3 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Feb 2008
Location: Mumbai/India
Posts: 1
Stumble this Post!
Here is the soln

The best ways is to use "sftp"

If you have "ssh-key generation between the client and host server then sftp is the best option.

code :

sftp $servername <<END_SCRIPT

Your code

END_SCRIPT


If you know concept of key gen then use sftp. keygen establish a connection between 2 server by which u dont need userid and pwd for connection..
Reply With Quote
  #4 (permalink)  
Old 02-05-2008
Registered User
 

Join Date: Apr 2007
Location: Kolkata
Posts: 81
Stumble this Post!
Thumbs up

Try this

user='user1'
password='password1'
IP='***.***.***.***'

ftp -n -i -v $IP 22 <<-END_SCRIPT > LOG_file
user $user $password
status
bin
lcd <DESTINATION DIR>
cd <REMOTE DIR>
mget *.*
bye
END_SCRIPT

Regards,
Pankaj
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:26 PM.


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