home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 5061 < prev    next >
Encoding:
Text File  |  1992-07-31  |  2.9 KB  |  64 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!news.den.mmc.com!pgl-devsvr.den.mmc.com!jzwiebel
  3. From: jzwiebel@pgl-devsvr.den.mmc.com (John Zwiebel 303-977-1480 jzwiebel@pgl-devsvr.den.mmc.com)
  4. Subject: chat2.pl and ! returns
  5. Message-ID: <1992Jul31.181234.27104@den.mmc.com>
  6. Sender: news@den.mmc.com (News)
  7. Nntp-Posting-Host: 147.105.201.12
  8. Organization: PAGE @ Martin-Marietta
  9. Date: Fri, 31 Jul 1992 18:12:34 GMT
  10. Lines: 48
  11.  
  12. I'm trying to get a couple of scripts to log on to my cisco routers and either download or upload configuration files.  For the most part the script works except for my last line.  I want to receive confirmation that the script worked.  Since I have 3 switches to indicate -d ( the directory to load to or from) -r (the router to telnet to) -s ( the host to store the config files on).  I also have a default list of routers to connect to (so I get everything).  A default host and a default directory.  If I us
  13.  
  14.  
  15.  
  16.  
  17. e all the defaults (no switches) I get:
  18.  
  19. OK]
  20. pgl-cgs6#
  21. OK]
  22. pgl-cgs7#
  23.  
  24. If I try to store to a host that doesn't support tftp nothing comes back although the router is sending:
  25.  
  26. Writing pgl-ags8-confg ..... [Failed]
  27.  
  28. If I am successful the router returns:
  29. Writing /tftpboot/pgl-ags8-confg !!!!!!!!! [OK]
  30.  
  31. I can also go to a host that supports tftpd but not the directory:
  32.  
  33. Writing pgl-ags8-confg
  34. TFTP error code 2 received - tftpd: 0827-604 There is a disk access violation.
  35.  [Failed]
  36.  
  37.  
  38. Basically, there are numerous combinations of switches and return values and all sorts of different stuff can be matched and returned by the chat script.
  39.  
  40. I figure I must be having trouble with the '[', ']' and '!' charactures but everything I've tried works under some conditions but not others.  
  41. Here's a list of some of the combinations I've tried (I was desparate):
  42.  
  43. #   $buf = &chat'expect( 5, '(\!*.\[)', $1); #, '(.*fail.*\[)', $1);
  44. #   $buf = &chat'expect( 5, '(.*directory*.])', $1, '(\!*.\[)', $1);
  45. #   $buf = &chat'expect( 5, '(.{10,})', $1, '(\!*.\[)', $1);
  46. #   $buf = &chat'expect( 5, '(\!*.\[)', $1, '(\W*\[Failed)', $1);
  47. #   $buf = &chat'expect( 5, '(\!*.\[)', $1);
  48. #   $buf = &chat'expect( 5, '(\[)', $1);
  49.     $buf = &chat'expect( 5, '(.\[)', $1, '(confg \.*.\[Failed)', $1);
  50.  
  51. The '(\[)', $1 combination seems to provide the best results, however, the way I read my nutshell book this shouldn't work at all!!  (See the results above).
  52.  
  53. Who wants to make a guess?  My other chat scripts (one to get router cpu usage and another to track bridging information for specific enet addresses) are working just fine.  But they don't have to deal with the `[]!' charactures.
  54.  
  55. Oh yes, I should tell you that sometimes I can get 0 or 'd' or 'r' returned, which is sort of suspicious since they are related to the switch I send.  One last bit of info I do use the getopt.pl package to read @ARGV.  
  56.  
  57. I'm betting there must be some special perl variable that I'm not aware of.  
  58.  
  59. Again, any guesses?
  60.  
  61. Email much appreciated.
  62.  
  63. John Zwiebel
  64.