Listing 1: netrc_check
#!/bin/sh
#
# 12 August 1996 - Russ Hill
#
# update the .netrc
# keep the id from expiring
#
NETRC="/home/rhill/.netrc"
NETRCBAK="/home/rhill/.netrc.bak"
NETRCBAK2="/home/rhill/.netrc.bak.2"
PID=$$
WORD=`/home/rhill/bin/mpw | awk '{printf("%s"),substr($1,1,4)}'`
PASSWD=${WORD}${PID}
OLDPASSWD=`grep rh ${NETRC} | awk '{print $6}' | awk -F'/' '{print $1}'`
mv ${NETRC} ${NETRCBAK}
cat > ${NETRC} <<!
machine rh login CPCA713 password ${OLDPASSWD}/${PASSWD}/${PASSWD}
!
chmod 600 ${NETRC}
ftp rh <<!
quit
!
mv ${NETRC} ${NETRCBAK2}
cat > ${NETRC} <<!
machine rh login CPCA713 password ${PASSWD}
!
chmod 600 ${NETRC}
|