Skip to Content
Learning Linux Shell Scripting - Second Edition
book

Learning Linux Shell Scripting - Second Edition

by Ganesh Sanjiv Naik
May 2018
Beginner
332 pages
7h 28m
English
Packt Publishing
Content preview from Learning Linux Shell Scripting - Second Edition

The menu box (menu)

Usually, a program or shell script may be required to perform multiple types of tasks. In such cases, the menu box option is very useful. This option will display a list of choices for the user. Then, the user may select an option of their own choice. Our script should execute the desired option.

Each menu has two fields, a tag and an item string. In the next example menu demo, we have tags such as date, calendar, and editor. A description of a tag is called an item string.

Let's write the dialog_04.sh shell script to create a menu as follows:

#!/bin/bash # Declare file to store selected menu option RESPONSE=menu.txt # Declare file to store content to display date and cal output TEMP_DATA=output.txt vi_editor=vi # trap ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Linux Shell Scripting

Learning Linux Shell Scripting

Ganesh Sanjiv Naik
Linux Shell Scripting Cookbook - Third Edition

Linux Shell Scripting Cookbook - Third Edition

Clif Flynt, Sarath Lakshman, Shantanu Tushar

Publisher Resources

ISBN: 9781788993197Supplemental Content