Menu script

It's me again :slight_smile:

I would like to create a script that will display a 'Main Menu' which will link to other scripts in the same directory. Is it possible to have a scrolling menu and pretty colours for this? :slight_smile:

My humble bare knowledge and incomplete understanding tells me you would like to do some ncurses-like thing. However, I don't think ncurses libraries can be driven by a shell script. Needs some C programming i think.

Otherwise, I think the only way left is to use embed ANSI color sequences but it just adds some color and you can't have effects like the use of arrow keys to jump between and highlight items etc.

if you use ksh you can easily use select or case to build a text menuing system.

Something like this ksh script (on an 80 col x 25 row screen), where things are carefully positioned.. but this script doesn't include colors, just a menu:

choice=0

while [ $choice -ne 4 ]
do

clear

echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""
echo "                ###############################################"
echo "                # Choose a script to run from the list below: #"
echo "                #                                             #"
echo "                # 1) Rename script   (./scr)                  #"
echo "                # 2) Another script  (./folder/another)       #"
echo "                # 3) OneMore script  (../progs/onemore)       #"
echo "                #                                             #"
echo "                # 4) QUIT                                     #"
echo "                #                                             #"
echo "                ###############################################"

echo ""
echo -n "                Choice: "
read choice

case "$choice" in
 1 ) ./scr ;;
 2 ) ./folder/another ;;
 3 ) ../progs/onemore ;;
 4 ) clear; exit 1 ;;
esac

done

thanks guys, it's a good start :slight_smile:

See this tutorial for more information on coloring text using ansi codes: http://www.freeos.com/guides/lsst/misc.htm\#colorfunandmore

i tried to do search on how to create color text in UNIX and found some. but when i tried to apply them it seems not to be working. i dont know if there is something to do with my terminal settings. if i understand it right my terminal should support colors in order to make one. if so, how can i know my terminal settings and change them? is it permanent or temporary?

thanks,

Could be the program you use doesn't allow it - what's the name of the program you use to connect to your Unix machine?

reflection x...

after a while... nu ninu ninu... hey it now works fine... i dunno what happened but it now works...

thanks a lot

What about using tcl/tk?