How to define macros in .netrc?

Mike Gleason 231b3679 at fergvax.unl.edu
Thu May 9 22:44:20 AEST 1991


I have tasted the power in FTP's .netrc file but I want more.  Right now I
have my .netrc set up so it will log me in automatically whenever it finds a
host defined in the .netrc.  I was reading the manual for ftp and it says that
you can also define macros along with everything else, and if you define a
macro called 'init' it will execute that macro when you login.  Here's what
I would like to have for every site in my .netrc:

machine rascal.ics.utexas.edu
	login anonymous
	password 231b3679 at fergvax.unl.edu
	macdef init
	cd pub
	type i
	verbose
	ls -lrt

You get the idea; basically I want it login and execute a few commands.  My
problem is that this doesn't work.  Although the man page for ftp says it
recognizes the 'macdef' option along with 'machine','login','password', and
'account', it DOESN'T!  I know I am defining my macro right, because it works
at the ftp command line.  Whenever I try to login to the example above, ftp
spits out a whole bunch of "Unrecognized .netrc keyword"s for macdef, cd pub,
etc.  A local guru around here suggested trying to use the 'command' keyword. I
did try it, and this time ftp didn't barf on it, but it just ignored it.  If
anyone has figured out how to define startup macros in the .netrc, I would be
grateful for an email!

_mike gleason
231b3679 at fergvax.unl.edu



More information about the Comp.unix.questions mailing list