Shell script to create a DOS-like Menutiem

Dear all,

Greetings !
I am writing in order to pick your brains on an issue I have.
If you remember in good old MS-DOS, one was able to change the autexec.bat and config.sys files so as to enable various configuration menus.

I used it in order to have my PC (486 DX 66MHZ) run games with all of the available memory, or simply run WIndows (3.1.x), and sometimes I would even set a menu for each game (e.g Colonization by Sid Meyer, Worms, and Star Fighter).

Now, the nice thing I remember about this menu configuration is the appearance of a BOX which you could manipulate by using the cursor arrow keys instead of typing the menu name. It was also possible to use an index, such as 1,2,3.

I know that Bash (In Sun Solaris) is more powerfull than DOS (sorry mate), and should allow such menu creation. Although this does not relate to system configuration menus, I would need a trick to:

1- create such a menu
2- use BOXes
3- use the arrow keys (possibly using ASCII tables)

I would appreciate any help in this direction, either in the form of:
1- algorithm
2- source code
3- or just ideas

Many thanks

from Da Bionic One

You can try something very simple, like:

again=1
while [ $again -eq 1 ]
do
echo "1 - Option A"
echo "2 - Option B"
echo "3 - Option C"
echo "Enter your choice: \c"; read choice

    case $choice in
            1|A\)    again=0;echo "one";;
            2|B\)    again=0;echo "two";;
            3|C\)    again=0;echo "three";;
            *\)      echo "wrong choice";;
    esac

done

User can enter 1, 2, 3, A, B, C only. Loops on menu otherwise.

Hope that'll do :stuck_out_tongue:

Many thanks Usfrog,

I will try this asap !

Merci beaucoup !