LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-07-2007, 04:28 AM   #1
kalyanofb
LQ Newbie
 
Registered: Feb 2007
Posts: 21

Rep: Reputation: 15
Automate FTP session using Shell Script


Friends,

I want to automate a FTP session using shell script. Which is the best way to do this?


How to know whether FTP completed successfully or not?


Thanks to all who are going to give solutions.

KALYANA RAMAN.M
 
Old 04-07-2007, 08:19 AM   #2
cmnorton
Member
 
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35
one way

#!/bin/sh
HOST='nohost'
USER='someuser'
PASSWD='somepwd'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit $?
 
Old 04-07-2007, 08:44 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,481

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
If you don't care having your password showing up in ps output, this should work too:
Code:
wget ftp://$USER:$PASSWD@HOST/$FILE
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto ftp shell script mcrosby Linux - Newbie 9 06-27-2007 06:09 AM
ftp through shell script HSN Programming 24 02-23-2007 03:18 PM
shell script for ftp javier_ccs Programming 7 07-18-2006 11:02 PM
Kermit Script to Automate FTP SSL/TLS fiddelm3742 Linux - Software 0 05-18-2004 11:53 PM
shell script to autologin into a telnet session eastj1974 Linux - General 1 11-17-2003 07:58 PM


All times are GMT -5. The time now is 08:52 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration