home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.1 (User) / OpenStep 4.1 (User).iso / usr / template / client / etc / ppp / Examples / ppp_multiple_hosts / chat.sh next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-01-30  |  551 b   |  26 lines

  1. #!/bin/sh
  2. #    Chat to get to a PPP system...
  3.  
  4. #
  5. #     FIXME: Is there a better way to figure out what folder I'm in?
  6. #
  7. PPPHOST=`(cd /etc/ppp/hosts ; for x in * ; do 
  8.     echo -n ""
  9.     if [ "/etc/ppp/hosts/${x}/../../chat.sh" = "$0" ]; then 
  10.         echo ${x}; 
  11.     fi 
  12. done)`
  13.  
  14. /usr/local/bin/chat -f /etc/ppp/hosts/${PPPHOST}/chat.script 
  15.  
  16. RETVAL=$?
  17.  
  18. if [ "$RETVAL" = 0 ]; then
  19. #
  20. #    FIXME: There must be a better way to do this...
  21. #
  22.     (echo `/bin/date | awk '{print $2,$3,$4}'` `/bin/hostname` "chat.sh[$$]" "Connected to ${PPPHOST}" > /dev/console 2>&1)
  23. fi
  24.  
  25. exit $RETVAL
  26.