Skip to main content
1 of 3
John WH Smith
  • 16.5k
  • 6
  • 54
  • 63

dialog is a great tool for what you are trying to achieve. Here's the example of a simple 3-choices menu:

dialog --menu "Choose one:" 10 30 3 \
    1 Red \
    2 Green \
    3 Blue

The syntax is the following:

dialog --menu <text> <height> <width> <menu-height> [<tag><item>]

The selection will be sent to stderr. If you want to test it using a file:

dialog --menu "Choose one:" 10 30 3 1 Red 2 Green 3 Blue 2>/tmp/result.txt

And just have a look at /tmp/result.txt.

John WH Smith
  • 16.5k
  • 6
  • 54
  • 63