/bash-menu-generator

A simple bash script that will generate menus

Primary LanguageShellMIT LicenseMIT

bash-menu-generator

A simple bash script that will generate menus.

Examples

alt Bash Menu Options Example

alt Bash Menu Instructions Example

Usage

I would recommend that you take a look at the example to see how to use the script.

generateDialog

Parameter 1: You can either use options=() which gives you a list of options like this OR you can use instructions=() which shows a set of instructions like this.

Parameter 2: Title for the menu. In the examples above these are "Choose an option" and "GitHub Instructions".

Parameter 3: Array of options or instructions to show. See the example

e.g. generateDialog "options" "Choose an option" "${options[@]}"

Configuration

  • symbol - Which character to be used to create the menu.
  • paddingSymbol - Character to space and center the text.
  • lineLength - How wide the menu should be.
  • charsToOption - How much padding you want from the sides of the menu.
  • charsToName - How much padding you want around the text.

Troubleshooting

If you try to run the example and you get the error:

zsh: permission denied: ./example.sh

Then you need to update the permissions for the file by running:

chmod +x example.sh