Shell Scripting - How do we can create a sample ~/.dialogrc file
Last Updated :
02 Jan, 2023
The dialog command allows you to display a variety of questions or messages from a shell script using dialog boxes. The ~/.dialogrc file is a run-time configuration file for dialog commands. Basically, it is the default configuration file. Also, the ~/.dialogrc file allows us to customize various aspects of the dialog command. If you do not have the dialog command installed, run the following commands to install it:
sudo apt-get install dialog
Steps for creating a sample ~/.dialogrc file using bash scripting.
Step 1: Create a bash file with extension .sh using the vim editor. Here other editors such as nano, and gedit can also be used at user convenience.
Step 2: Adding script into the bash script file i.e. bash.sh for creating the sample dialogrc file.
Bash Script for creating dialogrc file
#!/bin/bash
dialog --create-rc ~/.dialogrc
Output:
Bash Script for creating dialogrc file
Step 3: Now, after successfully saving the bash script, we need to execute the script using the command given below
sh bash.sh
Above command will run the bash script in the bash.sh file and as a result a sample ~/.dialogrc file is created.
We can view the content of the sample ~/.dialogrc file using the below command
vi ~/.dialogrc
Output :
The content of our sample ~/.dialogrc file was as given below :
# Run-time configuration file for dialog
#
# Automatically generated by "dialog --create-rc <file>"
#
#
# Types of values:
#
# Number - <number>
# String - "string"
# Boolean - <ON|OFF>
# Attribute - (foreground,background,highlight?)
# Set aspect-ration.
aspect = 0
# Set separator (for multiple widgets output).
separate_widget = ""
# Set tab-length (for textbox tab-conversion).
tab_len = 0
# Make tab-traversal for checklist, etc., include the list.
visit_items = OFF
# Shadow dialog boxes? This also turns on color.
use_shadow = ON
# Turn color support ON or OFF
use_colors = ON
# Screen color
screen_color = (CYAN,GREEN,ON)
# Shadow color
shadow_color = (BLACK,BLACK,ON)
# Dialog box color
dialog_color = (BLACK,WHITE,OFF)
# Dialog box title color
title_color = (BLUE,WHITE,ON)
# Dialog box border color
border_color = (WHITE,WHITE,ON)
# Active button color
button_active_color = (WHITE,BLUE,ON)
# Inactive button color
button_inactive_color = (BLACK,WHITE,OFF)
# Active button key color
button_key_active_color = (WHITE,BLUE,ON)
# Inactive button key color
button_key_inactive_color = (RED,WHITE,OFF)
# Active button label color
button_label_active_color = (YELLOW,BLUE,ON)
# Inactive button label color
button_label_inactive_color = (BLACK,WHITE,ON)
# Input box color
inputbox_color = (BLACK,WHITE,OFF)
# Input box border color
inputbox_border_color = (BLACK,WHITE,OFF)
# Search box color
searchbox_color = (BLACK,WHITE,OFF)
# Search box title color
searchbox_title_color = (BLUE,WHITE,ON)
# Search box border color
searchbox_border_color = (WHITE,WHITE,ON)
# File position indicator color
position_indicator_color = (BLUE,WHITE,ON)
# Menu box color
menubox_color = (BLACK,WHITE,OFF)
# Menu box border color
menubox_border_color = (WHITE,WHITE,ON)
# Item color
item_color = (BLACK,WHITE,OFF)
# Selected item color
item_selected_color = (WHITE,BLUE,ON)
# Tag color
tag_color = (BLUE,WHITE,ON)
# Selected tag color
tag_selected_color = (YELLOW,BLUE,ON)
# Tag key color
tag_key_color = (RED,WHITE,OFF)
# Selected tag key color
tag_key_selected_color = (RED,BLUE,ON)
# Check box color
check_color = (BLACK,WHITE,OFF)
# Selected check box color
check_selected_color = (WHITE,BLUE,ON)
# Up arrow color
uarrow_color = (GREEN,WHITE,ON)
# Down arrow color
darrow_color = (GREEN,WHITE,ON)
# Item help-text color
itemhelp_color = (WHITE,BLACK,OFF)
# Active form text color
form_active_text_color = (WHITE,BLUE,ON)
# Form text color
form_text_color = (WHITE,CYAN,ON)
# Readonly form item color
form_item_readonly_color = (CYAN,WHITE,ON)
The screenshots of the sample ~/.dialogrc file created through the execution of bash.sh.
Conclusion :
Thus, we successfully created a sample ~/.dialogrc file using bash scripting.
Similar Reads
Shell Scripting - Dialog Boxes In this article, we will create a shell script that generates a Dialog Box with GUI generating a message to the user. What is a Dialog Box? A Dialog Box is a temporary window an application runs to convey important information to the users. These dialog boxes can be used to display warnings, errors,
7 min read
Creating dialog boxes with the Dialog Tool in Linux The dialog package is a nifty little tool that was originally created by Savio Lam and is currently maintained by Thomas E. Dickey. This package actually recreates standard Windows dialog boxes in a text environment using ANSI escape control codes. These dialog boxes can be easily incorporated into
8 min read
How to compile a Typescript file ? TypeScript is a robust, open-source programming language developed and maintained by Microsoft. As a syntactic superset of JavaScript, TypeScript enhances its foundational language by introducing additional features, including strong typing and object-oriented programming capabilities. Unlike JavaSc
3 min read
Create an Import File Button with Tkinter Graphical User Interfaces (GUIs) play a crucial role in enhancing the user experience of applications. Tkinter, a built-in Python library, provides a simple way to create GUI applications. In this article, we will focus on creating an "Import File" button using Tkinter. Create An Import File Button
3 min read
How to initialize a dialog without a title bar ? The task is to initialize a dialog without a title bar. In this article, we will see how to initialize the dialog box without any title bar. A Dialog box is used to provide information in a particular way on the HTML pages. It creates a small window that is protected from the page content. If you wa
2 min read