home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!mcsun!sunic!dkuug!login.dkuug.dk!kimcm
- From: kimcm@login.dkuug.dk (Kim Chr. Madsen)
- Subject: Re: Curses like menu in a bourne shell script
- Message-ID: <kimcm.726436445@login.dkuug.dk>
- Sender: news@dkuug.dk
- Nntp-Posting-Host: login.dkuug.dk
- Organization: DKnet
- References: <38155@uflorida.cis.ufl.edu>
- Date: Thu, 7 Jan 1993 19:54:05 GMT
- Lines: 56
-
- pm0@bale.cis.ufl.edu (Patrick Martin) writes:
-
- >I wish to create a bourne shell menu which will read the cursor
- >keys and scroll a highlighted bar across a list of menu items.
- >I wish for return on a menu item to select that menu item.
-
- That will be a problem, since the shell does not have general I/O
- routines, and what is required is a routine to read
- character-by-character, and determine if the "string" sent by the
- cursor keys, have been manually entered or entered by the key. This is
- best done i a c-program.
-
- However, displaying things is quite another matter, there you can use
- the full variety of information stored in the TERMCAP/TERMINFO
- database -- it works best if your shell has functions....
-
- #!/bin/sh
-
- gotoxy() {
- tput smcup
- tput cup $2 $1
- tput rmcup
- }
-
- standout() { tput smso ; }
- nostandout() { tput rmso ; }
-
- printat() {
- gotoxy $1 $2
- shift 2
- echo $*
- }
-
- printat 10 5 "This is a test"
- standout
- printat 10 6 "This is a line in standout"
- nostandout
- printat 11 7 "The word `tput smul`underlined`tput rmul` is underlined"
-
-
-
- Regards,
- Kim Chr. Madsen
-
-
- >Sounds alot like curses I know.
-
- >I dont want the solution to be entirely bourne shell (ie: I do
- >not wish to write a supporting C routine to perform any subtasks).
- >I also do not wish to have to write a termcap.
-
- >Is this possible or is it too much to ask of bourne shell?
-
- >Thanks (I hope) in advance,
-
- >Pat
-