home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3861 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.9 KB  |  66 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!sun-barr!ames!ads.com!pdel
  3. From: pdel@ADS.COM (Peter Delevoryas)
  4. Subject: Simulating keyboard input in interactive programs
  5. Message-ID: <1992Sep9.045525.2667@ads.com>
  6. Sender: usenet@ads.com (USENET News)
  7. Organization: Advanced Decision Systems, Mtn. View, CA (415)960-7300
  8. Distribution: usa
  9. Date: Wed, 9 Sep 1992 04:55:25 GMT
  10. Lines: 54
  11.  
  12. Okay I've been reading for over two weeks, plus yesterday I caught up
  13. on 500 articles, so I should be entitled to:  THE POST!!
  14.  
  15. Not only that, I have two (somewhat related) questions :
  16.  
  17.  
  18. #1.
  19.     How do you simulate a keypress in an interactive program
  20.     which is within a script ? (If this is a FAQ I'm dead, I know.
  21.     Oh well the public ridicule is worth the answer ).
  22.  
  23.     Example: (csh)
  24.  
  25.     % while ( 1 )
  26.     > restore ivf /dev/tape
  27.     > mt fsf 1
  28.     > end
  29.  
  30.     Now upon execution of the restore, this will give me the
  31.     partition name and dumpdate, which is what I want to see.
  32.     Since it's interactive, it will wait for a prompt to tell
  33.     it what to do next. All I want to do is get the script to
  34.     type in a 'q' to make the restore quit so 'mt fsf' can go
  35.     to the next filemark.
  36.  
  37.  
  38.     I don't want to do 'restore t' because that won't give me
  39.     the dumpdates and partition name.
  40.  
  41.     So how can I put the 'q' character in there at the right time?
  42.  
  43.  
  44.  
  45. #2
  46.     This is kind of related to #1. Our dial-in lines are set to
  47.     auto-log out after about 20 min. of inactivity. Short of
  48.     programming the terminal-server not to do this, how can I
  49.     keep a process going so that it always seems like I'm doing
  50.     something, even if I'm in the kitchen making a BLT (extra mayo).
  51.     Just starting up some kind of loop won't do it; it has to be
  52.     equal to a keypress from MY keyboard.
  53.  
  54.     This probably belongs in unix.sys or some-such, but, since I'm
  55.     here already..... okay, I'll cross-post.
  56.     
  57.     
  58.  
  59. thanks for help,  PD
  60.  
  61. --
  62.  
  63.  login name:   L1-A                      
  64.  In real life: Peter Delevoryas
  65.  In any other life: a cheap imitation
  66.