Using dialog for menu-driven interactive scripts
Now that we've used expect
, we know how to interact with other applications. The only thing left to do is learn how to make our scripts more interactive. It will come as no surprise that this problem is already solved in a standard way. In this recipe, we will use dialog
, a command that may look deceptively simple but enables you to create both complex and visually interesting interactions with end users.
Getting ready
By definition, dialog
, as with any interaction, makes your scripts unusable in a non-interactive environment. This can be solved by either not using dialog
at all or detecting if the script is running as a service or as an interactive script.
Like expect
, we must install dialog
to use it. Simply use the following command:
sudo apt install dialog
Everything that you need is going to be installed as required.
How to do itβ¦
dialog
is a whole application that contains not only menus but...