If you're using bash, you could use the "select" loop, altough then your script won't work in the regular Bourne shell. The following information is from "Sams Teach Yourself Shell Programming in 24 Hours".

The basic syntax of select is:

select name in word1 word2 ... wordN
do
        list
done

name represents the name of a variable
word1 to wordN represent words seperated by spaces
list represents the set of commands to execute after the user has made a selection.

The book also gives an example of "select" being used for software configuration. The actual commands have been omitted:

select COMPONENT in comp1 comp2 comp3 all none
do
        case $COMPONENT in
                comp1|comp2|comp3) CompConf $COMPONENT ;;
                all) CompConf comp1
                     CompConf comp2
                     CompConf comp3
                     ;;
                none) break ;;
                *) echo "ERROR: Invalid selection, $REPLY." ;;
        esac
done

Hope this helps.

-Tiernan C.
                
                

Shawn wrote:
I've been trying to create a script file to automate some tasks, and have come across some points that could use some outside input....

The script uses a menu interface. Basically, something like "Select what task to do:", list the tasks, then the user hits a key (or types a value followed by enter).

I found reference to the "read" command to get a value from the user. But it's not quite the best fit... It shows a flashing cursor, and control characters if the user happens to hit a cursor key. Is there a better suited command/tool for this? Ideally I'd like to label the tasks/options with letters, and then have the user just tap that letter - no enter key needed.




_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to