Reputation: 11824
I wish to break while loop, that keep asking me for password using zenity, when user click cancel in password dialog...otherwise program should keep asking for password.
This is my first problem, but second one is, that even if I enter good password at the while loop is keep running and keep asking me for password.
VAR_PASS = $(zenity --password)
while ! $VAR_PASS | sudo -S echo ''; do
VAR_PASS=$(zenity --password)
#check if cancel button pressed, then return
done
Upvotes: 2
Views: 5726
Reputation: 246847
VAR_PASS=""
while [[ -z $VAR_PASS ]] || ! sudo -S echo <<< "$VAR_PASS"; do
VAR_PASS=$(zenity --password)
if [[ $? -eq 1 ]]; then
# cancel button pressed
elif [[ $? -eq 5 ]]; then
# timeout
fi
done
Upvotes: 7