Last edited by schragge; April 6th, 2013 at 02:34 PM.
Whiptail displays various types of controls inside a terminal window. Things like information boxes, error boxes, text entry boxes, etc.
Zenity and Dialog do a similar job, but they display a separate window, rather than using the existing terminal. The window will match the desktop environment being used, so on default Ubuntu it will have an orange close button, etc.Code:whiptail --msgbox "This is what Whiptail looks like" 10 30
Screenshots of Whiptail and Zenity attached.Code:zenity --info --text="This is what Zenity looks like"
For a password box with '*':
Code:zenity --entry --text="Password" --hide-text
Last edited by r-senior; April 6th, 2013 at 06:38 PM. Reason: Added password dialog
Please create new threads for new questions.
Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].
The whole script done with whiptail:
Code:#!/bin/bash -e get_password() { exec 3>&1 REPLY=`whiptail --ok-button 'Unlock' --nocancel --passwordbox 'Enter password:' 7 21 2>&1 1>&3` exec 3>&- return 0 } while get_password [[ $REPLY != 'password' ]] do whiptail --ok-button 'Try again' --msgbox 'Access denied!' 7 19 done whiptail --ok-button 'Continue' --msgbox 'Access granted!' 7 19
Last edited by schragge; April 6th, 2013 at 07:30 PM.
Well, you can read one character a time with read -sn1 and output an asterisk for it:
Code:#!/bin/bash password='' while read -sn1 char; do [[ -z $c ]] && break; echo -n \* password+=$char done echo echo $password
Last edited by schragge; April 8th, 2013 at 08:10 PM.
computer-howto
Linux is not windows
Fluxbox & Flux menu how to
Programming is an art. Learn it, Live it, Love it!
Bookmarks