home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume20
/
pcomm1.2
/
part02
/
Sample
< prev
next >
Wrap
Text File
|
1989-10-25
|
994b
|
49 lines
:
#
# This is a sample Bourne shell script to log a user onto a remote system.
# Things to remember:
# 1) Script files should have permissions of 700, to prevent others
# from gaining access to your passwords to remote systems.
# 2) The return codes for waitfor are: 0=success, 1=timed out, and
# -1=error.
#
echo ""
try=0
# loop until done
while true
do
# wait 5 seconds for the login prompt
waitfor -5 ogin:
# test the exit code of the waitfor command
if [ "$?" -eq 0 ]
then
# send my user ID and exit the loop
echo "egray"
break
fi
# increment the number of attempts
try=`expr $try + 1`
# test to see if we should give up
if [ "$try" -eq 5 ]
then
exit 1
fi
# send a modem break and loop again
modem_break
echo ""
done
# wait 5 seconds for the password prompt
waitfor -5 assword:
# test the return code from waifor
if [ "$?" -eq 0 ]
then
# send my password (you're crazy if you think that's my real password)
echo "abcdefg"
else
exit 1
fi
# return to Pcomm
exit 0