skla.blogg.se

Canceled universal usb installer
Canceled universal usb installer





canceled universal usb installer

I prefer to use case so I could even test for yes | ja | si | oui if needed. Bash specific solutions Basic in line method read -p "Is this a good question (y/n)? " answer Where 20 is height of dialog box in number of lines and 60 is width of the dialog box. Kdialog -yesno "Is this a good question" 20 60 & echo Yes

canceled universal usb installer

Gdialog -yesno "Is this a good question" 20 60 & echo Yes For example, using whiptail: if whiptail -yesno "Is this a good question" 20 60 thenĭepending on your system, you may need to replace whiptail with another similiar tool: dialog -yesno "Is this a good question" 20 60 & echo Yes There are many tools which were built using libncurses, libgtk, libqt or other graphical libraries. Adapting my first example to better serve multiple languages might look like this: set - $(locale LC_MESSAGES) It also loops automatically, so there's no need for a while true loop to retry if they give invalid input.Īlso, Léa Gris demonstrated a way to make the request language agnostic in her answer. With select you don't need to sanitize the input – it displays the available choices, and you type a number corresponding to your choice. Here is the same example using select: echo "Do you wish to install this program?" Read -p "Do you wish to install this program? " ynĪnother method, pointed out by Steven Huwig, is Bash's select command. The best way to illustrate its use is a simple demonstration: while true do The simplest and most widely available method to get user input at a shell prompt is the read command.







Canceled universal usb installer