Creating dialog boxes with the dialog utility
The dialog
utility is used to create a basic level graphical user interface. We can use this in Shell script to create very useful programs.
To install the dialog
utility in Debian or Ubuntu Linux, enter following command:
$ sudo apt-get update $ sudo apt-get install l dialog
Similarly, enter the following command to install the utility dialog in CentOS or Red Hat Linux:
$ sudo yum install dialog
The typical syntax of the dialog
command is as follows:
$ dialog --common-options --boxType "Text" Height Width \ --box-specific-option
The common-options
utility is used to set the background color, title, and so on in dialog boxes.
The option details are as follows:
- Text: The caption or contents of the box
- Height: The height of the dialog box
- Width: The width of the dialog box
Creating a message box (msgbox)
To create a simple message box, we can use the following command:
$ dialog --msgbox "This is a message...