Skip to content
Justice Tech School

select Menus

select builds a numbered menu and loops until break. The chosen text goes into the variable. The example feeds the answer in.

Example
PS3="Pick: "
select opt in red green blue; do
  echo "You chose $opt"
  break
done <<< "2"

Result

You chose green

Exercise

Menu keyword.

 opt in a b c; do break; done

Quiz Test

What does select create?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.