home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / question / 10997 < prev    next >
Encoding:
Internet Message Format  |  1992-09-12  |  1.6 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!wupost!sdd.hp.com!ux1.cso.uiuc.edu!bradley.bradley.edu!guru
  2. From: guru@camelot.bradley.edu (Jerry Whelan)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: .netrc entry for default ftp connects
  5. Keywords: ftp netrc
  6. Message-ID: <1992Sep12.215444.9640@bradley.bradley.edu>
  7. Date: 12 Sep 92 21:54:44 GMT
  8. References: <1992Sep12.184012.2519@lambda.msfc.nasa.gov>
  9. Sender: news@bradley.bradley.edu
  10. Organization: The Smelly Ditch
  11. Lines: 39
  12. Nntp-Posting-Host: stasi.bradley.edu
  13.  
  14. In article <1992Sep12.184012.2519@lambda.msfc.nasa.gov> thigpen@lambda.msfc.nasa.gov (Keith Thigpen) writes:
  15. -} .netrc works fine if I specify the machine that I want to contact. Often, tho,
  16. -} I want to jump out on the net and use anonymous ftp.
  17.  
  18. Well, then use this script (suitably modified for your situation) in
  19. place of ftp:
  20.  
  21.  
  22. #!/bin/sh
  23. #
  24. #    mftp   hostname
  25. #
  26. #    This script will take care of adding it to your .netrc
  27. #    for anonymous ftp.
  28. #
  29. #
  30.  
  31. # Check to see if this host is alread in the .netrc file
  32. egrep "machine *$1" $HOME/.netrc > /dev/null 2>&1
  33.  
  34. if [ $? != 0 ]
  35. then
  36.  
  37. # The host is not there so install the defaults
  38.  
  39.      /bin/echo machine $1\\nlogin ftp\\npassword \
  40. $LOGNAME@camelot.bradley.edu >> $HOME/.netrc
  41.     /bin/echo macdef init\\nbinary\\nprompt\\nhash\\n\\n >> $HOME/.netrc
  42. fi
  43.  
  44. # In case you ever put any real passwords in the .netrc file
  45. # you don't want someone else to look at it
  46. /bin/chmod 600 $HOME/.netrc
  47.  
  48. # Run ftp in verbose mode to the destined site
  49. ftp -v $1
  50.  
  51. -------------------------------------------------------------------------------
  52. ``written by a drunken insane pathological liar''        guru@stasi.bradley.edu
  53.