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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.