4
rated 0 times
[
4]
[
0]
/ answers: 1 / hits: 2192
/ 2 Years ago, sun, april 10, 2022, 9:12:02
I am writing a mount script for Windows share to run after login.
I have done it with bash and zenity and it works, but now I need to make it better so if username field and password field are empty then return to input.
Example
wUsername=`zenity --entry --width=300 --title="Mount $MOUNTDIR" --text="Kasutajanimi:"`
#if [ $? -ne 0 ]; then
# exit 1
#fi
if [ -z "$wUsername" ]; then
zenity --error --title="Viga kasutajanimes!" --text="Palun sisestage oma kasutajanimi"
# get the windows password
wPassword=`zenity --entry --width=300 --title="Mount $MOUNTDIR" --text="Parool:" --hide-text`
if [ $? -ne 0 ]; then
exit 1
fi
So I want this script to trow user back to input if Kasutajanimi aka username or Parool aka password is empty. Even if space is pressed.
I have searched the all mighty Google for it and I know I can do it with return somehow.
More From » bash