231b3679@fergvax.unl.edu (Mike Gleason) (05/09/91)
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@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@fergvax.unl.edu
max@compaq.com (Max Heffler) (05/11/91)
231b3679@fergvax.unl.edu (Mike Gleason) writes: >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@fergvax.unl.edu > macdef init > cd pub > type i > verbose > ls -lrt The following works for me: machine oswego.oswego.edu login anonymous password max@compaq.com macdef init ls Maybe it has something to do with line continuation... -- Max Heffler, Senior Software Engineer internet: max@compaq.com Compaq Computer Corporation uucp: ..!uunet!max@compaq.com P.O. Box 692000 - M050701 phone: (713) 378-8366 Houston, Texas 77269-2000 fax: (713) 374-7305
pravin@eniac.seas.upenn.edu (05/15/91)
In a previous article max@compaq.com (Max Heffler) writes: > >The following works for me: > >machine oswego.oswego.edu login anonymous password max@compaq.com macdef init >ls > >Maybe it has something to do with line continuation... I get a segmentation fault, when I try putting macdef in? Any clues? pravin -- pravin (215)573-4360 (h) (215)898-3211 (w)
max@compaq.com (Max Heffler) (05/15/91)
pravin@eniac.seas.upenn.edu writes: >In a previous article max@compaq.com (Max Heffler) writes: >> >>The following works for me: >> >>machine oswego.oswego.edu login anonymous password max@compaq.com macdef init >>ls >> >>Maybe it has something to do with line continuation... >I get a segmentation fault, when I try putting macdef in? Any clues? From man page of ftp: macdef macro-name Define a macro. Subsequent lines are stored as the macro macro-name; a null line (consecutive NEWLINE characters in a file or RETURN characters from the ter- minal) terminates macro input mode. There is a limit of 16 macros and 4096 total characters in all defined macros. Macros remain defined until a close command is executed. The macro processor interprets `$' and `\' as special characters. A `$' followed by a number (or numbers) is replaced by the corresponding argument on the macro invocation command line. A `$' followed by an `i' sig- nals that macro processor that the executing macro is to be looped. On the first pass `$i' is replaced by the first argument on the macro invocation command line, on the second pass it is replaced by the second argument, and so on. A `\' followed by any character is replaced by that character. Use the `\' to prevent special treatment of the `$'. -- Max Heffler, Senior Software Engineer internet: max@compaq.com Compaq Computer Corporation uucp: ..!uunet!max@compaq.com P.O. Box 692000 - M050701 phone: (713) 378-8366 Houston, Texas 77269-2000 fax: (713) 374-7305