The yes/no box (yesno)

If we need to obtain a yes or no answer from the user, we can use the following options along with the dialog command:

    $ dialog --yesno "Would you like to continue?" 10 50

We can have the same yes/no dialog box with a title as follows:

    $ dialog --title "yesno box" --yesno "Would you like to continue?" 10 50

Let's write the dialog_01.sh shell script as follows:

#!/bin/bash dialog --title "Delete file" --backtitle "Learning Dialog Yes-No box" --yesno "Do you want to delete file "~/work/sample.txt"?" 7 60 # Selecting "Yes" ...

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.