use PS1 to give naive users a menu

Rob Warnock rpw3 at redwood.UUCP
Thu Jan 17 14:22:56 AEST 1985


+---------------
| I've found that using the shell's prompt string (PS1) can be
| a really easy way of giving computer-naive users a menu of
| available commands, if the command set they need is very limited.
| ... 
| PS1='Type "mail", "notes", "learntax" or "bye": '
| ...!lsuc!dave | ...!utcsrgv!lsuc!dave
+---------------

(All of this set up in the poor user's ".profile", of course, or in
 /etc/profile for post-Sys-III.)

You can go one farther:

Many terminals have programmable function keys or at least function keys
that can emit a legal UNIX filename with a <cr>, such as the Fortune System's
<^A><letter><CR> ("letter" is "a" for f1, etc.), which is also the default for
the Televideo terminals. You can make UNIX commands whose names are (say)
"<^A>c" which can be run by hitting function key 3. ("Hey, don't be mean...")

Then PS1 can have a clear-screen sequence in it, and cursor positioning
stuff, and you can REALLY get a "menu" from a plain Bourne shell!!!
And the function-key-commands can be shell scripts that do "read"s and
interpret more function keys as sub-commands...

And the user "escapes" to UNIX by typing UNIX commands! Amazing!

(Try it... you'll gag! You may even use it!)


Rob Warnock
Systems Architecture Consultant

UUCP:	{ihnp4,ucbvax!dual}!fortune!redwood!rpw3
DDD:	(415)572-2607
USPS:	510 Trinidad Lane, Foster City, CA  94404



More information about the Comp.unix mailing list