> Use ftp command in shell script | Unix Linux Forums | Shell Programming and Scripting

  Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Use ftp command in shell script

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-05-2008
infyanurag infyanurag is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 7 November 2014, 8:44 AM EST
Posts: 86
Thanks: 7
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #2  
Old Unix and Linux 02-05-2008
V3l0 V3l0 is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 10 April 2008, 10:18 AM EDT
Location: Belgium & France
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
See the .netrc
Sponsored Links
    #3  
Old Unix and Linux 02-05-2008
srnayak17 srnayak17 is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 28 July 2011, 4:39 PM EDT
Location: Mumbai/India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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..
    #4  
Old Unix and Linux 02-05-2008
panknil panknil is offline
Registered User
 
Join Date: Apr 2007
Last Activity: 19 February 2013, 12:36 PM EST
Location: Kolkata
Posts: 90
Thanks: 2
Thanked 0 Times in 0 Posts
MySQL

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
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script running command in different shell gr8_usk Shell Programming and Scripting 9 05-23-2011 06:30 PM
help with shell script: cp command not working, but mv command works... udelalv Shell Programming and Scripting 1 04-12-2011 04:34 AM
can anyone help with shell script command about searching word with grep command? aintour Shell Programming and Scripting 2 10-14-2009 04:51 PM
Need to Write Shell Script based off of this shell command Rally_Point Shell Programming and Scripting 3 06-10-2009 05:19 PM
how to use cd command in shell script LAKSHMI NARAYAN Shell Programming and Scripting 3 09-09-2007 06:04 AM



All times are GMT -4. The time now is 05:59 PM.