Search code examples
linuxmenushell

Advanced Shell Script menu


I am writing a menu driven shell script and I have yes / no menu right now.

I want a menu like below :

    1) All                     [ ]    
    2) Config web server       [ ]
    3) Add Source files        [X]
    4) Restart Services        [ ]
    5) Apply file permissions  [ ]

The user should be then able to navigate up - down using arrow keys and press spacebar for selection. Pressing enter should proceed.

Has any of you seen such a menu from any opensource installation script or has any idea how to achieve it?


Solution

  • bash has the select builtin (which isn't so interactive, you need to input the number of the item to choose). And then there's the whiptail command which is a bit more involved but will do quite exactly what you want.