Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash script with graphical menus

Tags:

bash

shell

menu

I have been writing simple bash scripts for a while now, and I was wondering how I could implement simple menus and, if possible, use menus with color.

In the past, I have written simple C applications that use ncurses and would like to (if possible) have menus in my bash script where the user can use the up/down arrows to select items in a list, and go back/forth through a series of yes/no/cancel prompts.

I am familiar with setting up colored text in bash, so there's a start (eg: bash using colors), so the only requirement left at this point is to see if bash has these capabilities. I would prefer to avoid having to code an application in C/C++ for this, as I would like to be able to edit it on the fly.

like image 997
Cloud Avatar asked May 14 '12 00:05

Cloud


People also ask

Does bash have a GUI?

In fact, you are able to include GUI (Graphical User Interface) based input/output components into your next bash script using the Zenity command line tool which helps us to display GTK dialog boxes.

How do I make a script menu?

Steps included : Create a custom menu using echo statement and show the menu. Create an infinite loop using while statement that accept the user input option and generate the output continuously until the user input matches the exit pattern. Take input from the user using read statement and store it in a variable.

What is $() in bash script?

$() Command Substitution According to the official GNU Bash Reference manual: “Command substitution allows the output of a command to replace the command itself.


1 Answers

there is a package called dialog, is this relevant to your requirement?

like image 144
Bela Vizer Avatar answered Oct 16 '22 04:10

Bela Vizer