FTP from korn shell

FTP from korn shell

Post by brian hile » Wed, 29 Sep 1999 04:00:00




>   Is it possible to initiate an ftp session from a shell script ?  I'd like
> to initiate a session between a unix server and a laptop on a dial up
> connection.  Does the laptop have to be running an ftp server to do this ?

It really is a simply task--as you see now from the submissions of
people.  However, advanced programmers have made available ftp
front-ends of their own that automate this process, and I would
encourage you to have a look at their (debugged!) code.

ftp://ftp.mindspring.com/users/mwang/unix-prog/niftp/

-Brian

 
 
 

FTP from korn shell

Post by Bruce Moo » Tue, 05 Oct 1999 04:00:00


Here's one that does anonymous ftp:

----------snip
if [ -z "$2" ]; then
        echo "Usage: `basename $0` host commands"

        exit 1
fi

        tr ',;' '\012' | ftp -in
----------snip

        Just separate the FTP commands with commas or semicolons.

Bruce




>>   Is it possible to initiate an ftp session from a shell script ?  I'd like
>> to initiate a session between a unix server and a laptop on a dial up
>> connection.  Does the laptop have to be running an ftp server to do this ?

>It really is a simply task--as you see now from the submissions of
>people.  However, advanced programmers have made available ftp
>front-ends of their own that automate this process, and I would
>encourage you to have a look at their (debugged!) code.

>ftp://ftp.mindspring.com/users/mwang/unix-prog/niftp/

>-Brian


 
 
 

FTP from korn shell

Post by MaT » Wed, 06 Oct 1999 04:00:00


you can also use macros..

    echo "machine ftp.foobar.com" > /$HOME/.netrc
    echo "login root" >> /$HOME/.netrc
    echo "password insecure" >> /$HOME/.netrc
    echo "macdef init" >> /$HOME/.netrc
    echo "mget /etc/*" >> /$HOME/.netrc
    echo "put myfile" >> /$HOME/.netrc
    echo "quit" >> /$HOME/.netrc
    echo "" >> /$HOME/.netrc
    echo "" >> /$HOME/.netrc
    chmod 600 /$HOME/.netrc

    ftp ftp.foobar.com

matt