home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / shell / 5305 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.7 KB  |  69 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!dkuug!login.dkuug.dk!kimcm
  3. From: kimcm@login.dkuug.dk (Kim Chr. Madsen)
  4. Subject: Re: Curses like menu in a bourne shell script
  5. Message-ID: <kimcm.726436445@login.dkuug.dk>
  6. Sender: news@dkuug.dk
  7. Nntp-Posting-Host: login.dkuug.dk
  8. Organization: DKnet
  9. References: <38155@uflorida.cis.ufl.edu>
  10. Date: Thu, 7 Jan 1993 19:54:05 GMT
  11. Lines: 56
  12.  
  13. pm0@bale.cis.ufl.edu (Patrick Martin) writes:
  14.  
  15. >I wish to create a bourne shell menu which will read the cursor
  16. >keys and scroll a highlighted bar across a list of menu items.
  17. >I wish for return on a menu item to select that menu item.
  18.  
  19. That will be a problem, since the shell does not have general I/O
  20. routines, and what is required is a routine to read
  21. character-by-character, and determine if the "string" sent by the
  22. cursor keys, have been manually entered or entered by the key. This is
  23. best done i a c-program.
  24.  
  25. However, displaying things is quite another matter, there you can use
  26. the full variety of information stored in the TERMCAP/TERMINFO
  27. database -- it works best if your shell has functions....
  28.  
  29. #!/bin/sh
  30.  
  31. gotoxy() {
  32.     tput smcup
  33.     tput cup $2 $1
  34.     tput rmcup
  35. }
  36.  
  37. standout() { tput smso ; }
  38. nostandout() { tput rmso ; }
  39.  
  40. printat() {
  41.     gotoxy $1 $2
  42.     shift 2
  43.     echo $*
  44. }
  45.  
  46. printat 10 5 "This is a test"
  47. standout
  48. printat 10 6 "This is a line in standout"
  49. nostandout
  50. printat 11 7 "The word `tput smul`underlined`tput rmul` is underlined"
  51.  
  52.  
  53.  
  54.                         Regards,
  55.                         Kim Chr. Madsen
  56.  
  57.  
  58. >Sounds alot like curses I know.
  59.  
  60. >I dont want the solution to be entirely bourne shell (ie: I do
  61. >not wish to write a supporting C routine to perform any subtasks).
  62. >I also do not wish to have to write a termcap.
  63.  
  64. >Is this possible or is it too much to ask of bourne shell?
  65.  
  66. >Thanks (I hope) in advance,
  67.  
  68. >Pat
  69.