Eu faria assim:
#!/usr/bin/env bash
## Define a function that launches the zenity username dialog
get_username(){
zenity --entry --width=300 --title="Mount $MOUNTDIR" --text="Kasutajanimi:"
}
## Define a function that launches the zenity password dialog
get_password(){
zenity --entry --width=300 --title="Mount $MOUNTDIR" --text="Parool:" --hide-text
}
## Attempt to get the username and exit if cancel was pressed.
wUsername=$(get_username) || exit
## If the username is empty or matches only whitespace.
## See http://www.tldp.org/LDP/abs/html/string-manipulation.html
## for an explanation of this syntax. The . means any non-space
## character so when this is less than 1, the username is empty
## or just whitespace. Since this is a while loop, the process
## will be repeated until the username is correctly submitted.
while [ "$(expr match "$wUsername" '.')" -lt "1" ]; do
zenity --error --title="Viga kasutajanimes!" --text="Palun sisestage oma kasutajanimi"
wUsername=$(get_username) || exit
done
## Same as the previous loop but for the password. Sorry if
## the message is wrong, I don't speak this language :)
wPassword=$(get_password) || exit
while [ "$(expr match "$wPassword" '.')" -lt "1" ]; do
zenity --error --title="Viga Parool!" --text="Palun sisestage oma Parool"
wPassword=$(get_password) || exit
done