Pages

Creating yes no option box in linux scripting

In the post "Creating message box in a shell script" we saw how to create a message box using whiptail. Now let us see how to create a yes/no box where the user can choose one of the two and then the further action can be decided.

The syntax to create a yesno box using whiptail is



Example



 photo whiptail_yesno.png

If we select yes, the return value of the command will be 0, for no the return value will be 1. We can use the return value to decide the further course of action for the script.

Here is a script that keeps popping up the yes/no box as long as the user does not select "no" to stop the script.



$bash yesno.sh  photo whip_continue.png

 photo whip_yesno.png


No comments:

Post a Comment