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
How to Create a Shell Script in linux
Shell is an interface of the operating system. It accepts commands from users and interprets them to the operating system. If you want to run a bunch of commands together, you can do so by creating a shell script. Shell scripts are very useful if you need to do a task routinely, like taking a backup
7 min read
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
How to Make an Alert Dialog Fill Majority of the Screen Size in Android?
An Alert Dialog is a window that appears on the screen to give notifications to the user, make some decisions for the user, or enter some information from the user. An Alert Dialog is generally not full screen, but in this article, we'll be implementing something similar. Building an Alert Dialog:Ti
3 min read
How to execute TypeScript file using command line?
TypeScript is a statically-typed superset of JavaScript that adds optional type annotations and compiles to plain JavaScript. It helps catch errors during development. To execute a TypeScript file from the command line, compile it using tsc filename.ts, then run the output JavaScript file with node.
2 min read
How to Create a File in CMD
Creating a file using Windows GUI is very easy, but did you know that you can also create files using Windows CMD? Now, this article will walk you through the steps to create a file using CMD, ensuring that you can efficiently manage your files directly from the command prompt.How to Create a File i
4 min read
How to Change the Position of AlertDialog in Android?
AlertDialog in android is one of the UI widgets which immediately pops up to confirm the user interaction or to confirm the action which is done by the user. In most of the applications, the position of the alert dialog is in the center. In this article, it's been discussed how to change the positio
4 min read
How to Create a VIM File in Linux CMD
In Linux, there are many ways to open and create files, but Vim stands out as a powerful and versatile text editor. It comes pre-installed on most Linux systems and allows you to create, edit, and manage files directly from the terminal.In this article, we will explain you, how to create a new file
3 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
How to display a dialog box in the page ?
In this article, we are going to see how we can implement a dialog box on our webpage for certain actions. This can be implemented by using Several Methods.Possible Approaches:Using jQueryUI.Using Cascading Style Sheets.Explaining Each Approach:Approach 1 - Using jQueryUI: jQueryUI which is a collec
3 min read