home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!sdd.hp.com!ux1.cso.uiuc.edu!bradley.bradley.edu!guru
- From: guru@camelot.bradley.edu (Jerry Whelan)
- Newsgroups: comp.unix.questions
- Subject: Re: .netrc entry for default ftp connects
- Keywords: ftp netrc
- Message-ID: <1992Sep12.215444.9640@bradley.bradley.edu>
- Date: 12 Sep 92 21:54:44 GMT
- References: <1992Sep12.184012.2519@lambda.msfc.nasa.gov>
- Sender: news@bradley.bradley.edu
- Organization: The Smelly Ditch
- Lines: 39
- Nntp-Posting-Host: stasi.bradley.edu
-
- In article <1992Sep12.184012.2519@lambda.msfc.nasa.gov> thigpen@lambda.msfc.nasa.gov (Keith Thigpen) writes:
- -} .netrc works fine if I specify the machine that I want to contact. Often, tho,
- -} I want to jump out on the net and use anonymous ftp.
-
- Well, then use this script (suitably modified for your situation) in
- place of ftp:
-
-
- #!/bin/sh
- #
- # mftp hostname
- #
- # This script will take care of adding it to your .netrc
- # for anonymous ftp.
- #
- #
-
- # Check to see if this host is alread in the .netrc file
- egrep "machine *$1" $HOME/.netrc > /dev/null 2>&1
-
- if [ $? != 0 ]
- then
-
- # The host is not there so install the defaults
-
- /bin/echo machine $1\\nlogin ftp\\npassword \
- $LOGNAME@camelot.bradley.edu >> $HOME/.netrc
- /bin/echo macdef init\\nbinary\\nprompt\\nhash\\n\\n >> $HOME/.netrc
- fi
-
- # In case you ever put any real passwords in the .netrc file
- # you don't want someone else to look at it
- /bin/chmod 600 $HOME/.netrc
-
- # Run ftp in verbose mode to the destined site
- ftp -v $1
-
- -------------------------------------------------------------------------------
- ``written by a drunken insane pathological liar'' guru@stasi.bradley.edu
-