This tutorial gives examples of how to provide messages/dialogs in Bash Shell scripts using tools like zenity and whiptail. Using these tools, your script can tell the user what the current program is doing and interact with the user. The difference between these two tools is the way the message box or dialog is displayed. Zenity creates a graphical user interface with the GTK toolkit, while whiptail creates a message box within the terminal window.
Zenity Tools
Installing zenity in Ubuntu, run:
sudo apt-get install zenityThe command to create a message box or dialog with zenity is self-explanatory We will give you some examples for reference.
Create a message box
zenity --info --title "Information Box" --text "This should be information" --width=300 --height=200
Create a Yes/No query dialog
zenity --question --text "Do you want this?" --ok-label "Yeah" --cancel-label= "Nope"
Create an input box and save the input values to a variable
a=$(zenity --entry --title "Entry box" --text " ;Please enter the value" --width=300 --height=200)echo $a
When entered, the value is stored in the variable $a.
This is a real example of getting a user's name and displaying it.
#!/bin/bash## This script will ask for couple of parameters# and then continue to work depending on entered values## Giving the option to userzenity --question --text "Do you want To continue?"# Checking if user wants to proceed[ $? -eq 0 ]
Linux is a derivative of Unix operating system , Linux has built-in tools to view the current proce
There are WINDOWS on the computer and LINUX Some people like GRUB, and some people like NT Loader to
Faced with powerful Microsoft and early NetWare, Linux server operating system can be said to be a r
Use httpry to sniff HTTP traffic under Linux Tutorial Sometimes you want to sniff HTTP traffic for
Linux operating system to install WordPress service
Linux rc.local self-starting service
centOS automatically installs php
Rh442-1 use snmp and mrtg to monitor the network traffic of the Linux server
Introduction to APMD parameters and usage in Linux
Linux modify user group method
Linux user disk space restrictions Brief description
Linux system mount point and partition relationship
Linux system master road kernel compilation process analysis
Vista instead of web control router is simpler
Win10/WP10: Demystifying IE11 Edge file mode
How to connect LCD TV through HDMI under win7
QQ voice There are echo noise solutions
The principle of file deletion under linux
How Win10 creates a broadband connection to access the Internet
Four tricks to help you convert PPT text into Word document
How does Win10 wake up Xiaona? Win10 wakes up Xiaona method