This Bash script provides a simple interactive menu with three customizable commands and an option to exit. Each command is executed within the script, and the user is guided through the process. The script is designed with minimalism in mind, offering a condensed and clean interface for those who prefer simplicity. Additionally, colorful and formatted messages are incorporated for an enhanced user experience.
- Interactive menu with numbered options
- Execution of custom commands within the script
- Colorful and formatted output for improved readability
- Easily customizable commands and functionality
- Bash
-
Clone the repository:
git clone https://github.com/jveyes/bashmenu.git
-
Navigate to the script directory:
cd bashmenu
-
Run the script:
bash script.sh
-
Follow the on-screen instructions to navigate the menu.
- display_menu(): Displays a formatted menu with numbered options.
- execute_command1(): Executes Command 1 and displays a message (example code reads your linux local username).
- execute_command2(): Prompts the user for a parameter, executes Command 2, and displays a message.
- execute_command3(): Executes Command 3 and displays a message.
- The script contains a main loop that displays the menu, reads user input, and executes the corresponding function based on the choice.
- You can customize the commands executed in
execute_command1()
,execute_command2()
, andexecute_command3()
by adding your own commands.
In ANSI escape codes, you can use special sequences to add color to text in the terminal. Here's a quick reference for some common colors:
- ⚫️ Black:
\e[30m
- 🔴 Red:
\e[31m
- 🟢 Green:
\e[32m
- 🟡 Yellow:
\e[33m
- 🔵 Blue:
\e[34m
- 🟣 Magenta:
\e[35m
- 🔵 Cyan:
\e[36m
- ⚪️ White:
\e[37m
For brighter variations, you can use:
- ⚫ Bright Black (Gray):
\e[90m
- 🔴 Bright Red:
\e[91m
- 🟢 Bright Green:
\e[92m
- 🟡 Bright Yellow:
\e[93m
- 🔵 Bright Blue:
\e[94m
- 🟣 Bright Magenta:
\e[95m
- 🔵 Bright Cyan:
\e[96m
- ⚪ Bright White:
\e[97m
To apply color to your text, use the respective escape code before your text and \e[0m
at the end to reset the color.
Example:
echo -e "\e[91mThis text is in bright red\e[0m"
Contributions are welcome! If you find a bug or have suggestions for improvements, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.