Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to save a password to gnome keyring via python script. The python script will be runned from bash script if password is filled in zenity GUI.


User inserts hes/hers password to zenity password input and if the password is filled it will be saved to gnome keyring via python script, but if the password field is empty it moves on to next command that asks to input the password again.

So this is what I want to accomplish:

zenity --entry --width=300 --title="Mount $MOUNTDIR" --text="Password:" --hide-text

wPassword=$(get_password) || exit

while [ "$(expr match "$wPassword" '.')" -lt "1" ]; do
    zenity --error --title="Error in password!" --text="Please check your password! Password field can not be empty!" || exit
    wPassword=$(get_password) || exit

Once password field is filled then the bash script will run the python script to save the password to gnome keyring and then move to next command in script after the python script has been run and has saved the password.

This is example

if $get_password = true run save_pw.py

How do write it in bash?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.