- Bash Script: Create simple select menu using select statement

Here is simple bash script which creates an simple options selection menu using bash 'select' statement, fee free to modify/copy and use this script to suite your requirement.

$ cat select.sh
#!/bin/bash

# Selection menu items goes here
SELECTION="option1 option2 option3 quit"

select options in $SELECTION; do

# here using the if statements you can perform the required  operation
if [ "$options" = "option1" ]; then
    echo "You have selected $options"

elif [ "$options" = "option2" ]; then
    echo "You have selected $options"

elif [ "$options" = "option3" ]; then
        echo "You have selected $options"

elif [ "$options" = "quit" ]; then
        echo "You have selected $options"
    exit

# if something else is selected, show the menu again
else
    clear;
    echo "please select some options"

fi
done

Continue Reading...


source:http://linuxpoison.blogspot.com/2012/05/135781677512872.html