Computing.Net > Forums > Unix > Ftp thru shell script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Ftp thru shell script

Reply to Message Icon

Name: siddhartha
Date: July 10, 2001 at 12:30:09 Pacific
Comment:

could u pls send me the code on how to ftp thru shell script????



Sponsored Link
Ads by Google

Response Number 1
Name: stefan caunter
Date: July 17, 2001 at 19:47:47 Pacific
Reply:

what you need to do is test for the exit status of the ftp command in a subshell
first set a variable to be the exit status of ftp -n -i; if it is 0 everything is ok, if it is greater than 0, problem. soooo....
$var=`(ftp -n -i $REMOTE_HOST; echo $?)`
if [$var -eq 0] ; then
user xxxxx
pass xxxxx
elif [$var -gt 0] ; then
echo "Could not connect to $REMOTE_HOST"


0

Response Number 2
Name: meehong
Date: July 24, 2001 at 02:27:16 Pacific
Reply:

You can also write script like this:

#!/bin/sh

OUT=/user/out {FTP FROM}
FTPTO=192.XXX.XXX.XX
INPUT=/user/abc {FTP TO}

cd /user
echo "user XX{login} XX{passwd}">$OUT/123.out
echo "cd $INPUT/123" >> $OUT/123.out
echo "bi">> $OUT/123.out
echo "mput *" >>$OUT/123.out
echo "bye" >> $OUT/123.out
ftp -n -i $FTPTO < $OUT/123.out
rm -f $OUT/123.out
echo "FTP 123 Done"


***Hope this can help u


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Ftp thru shell script

ftp prompt from shell script www.computing.net/answers/unix/ftp-prompt-from-shell-script/5894.html

telnet & ftp through shell script?! www.computing.net/answers/unix/telnet-amp-ftp-through-shell-script/4850.html

can an FTP Korn Shell Script be written www.computing.net/answers/unix/can-an-ftp-korn-shell-script-be-written/3569.html