home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!mlb.semi.harris.com!controls.ccd.harris.com!sak
- From: sak@controls.ccd.harris.com (Scott Kassan)
- Subject: Re: FTP - macros and macdef
- Message-ID: <1992Dec23.124123.5765@ccd.harris.com>
- Originator: sak@rs2
- Keywords: FTP Macro Macdef
- Sender: sak@controls (Scott Kassan)
- Organization: Harris Controls
- References: <1992Dec22.202855.20553@magnus.acs.ohio-state.edu>
- Date: Wed, 23 Dec 1992 12:41:23 GMT
- Lines: 55
-
-
- The ftp on my system supports a .netrc file and a special macro called init
- that gets invoked upon startup. I wrote the following script to automate
- the transfer of many files from one machine to another. I'm not sure if
- these features are supported on all platforms, but I thought it was worth
- mentioning.
-
- --------------------------- cut here ------------------------------------
- if [ "$1" = "" ]
- then
- echo "USAGE: ftp.script nodename"
- exit
- fi
-
- if [ -f $HOME/.netrc ]
- then
- cp $HOME/.netrc /tmp/$$
- RESTORE="cp /tmp/$$ $HOME/.netrc ; rm /tmp/$$"
- else
- RESTORE="rm $HOME/.netrc"
- fi
-
- cat > $HOME/.netrc <<!END
- machine $1
- macdef tx
- put "|cat \$1 2> /dev/null || get -p -s s.\$1" \$2
-
- macdef t
- \$tx \$1 \$1
-
- macdef t2
- \$tx \$1 \$2
-
- macdef init
- !$RESTORE
- hash
- cd $SYST
- lcd $PROJ/../..
- ascii
- put file1
- \$t file2
- \$t2 file3
- quit
-
- !END
- #
- # note: the blank line before !END is required to end the definition
- # of the init macro
- #
- ftp $1
- ------------------------------------- cut here ---------------------------
- --
- Scott Kassan | "And all this science I don't understand
- email: s.kassan@ccd.harris.com | It's just my job five days a week"
- | -- Elton John, "Rocket Man"
-