Concealing keyboard input? Or how to display *****'s instead of text

Hi,
I'm writing a bash script to run under Cygwin to change users passwords on a Windows domain controler. My script uses the Windows "net user" command and I feed it the password as a variable.

In my script I'm using "read" to capture keyboard input into a variable but ofcourse the password is displayed on the screen. Is there a way I can conceal the password input with *****'s?
LVL 15
veedarAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
grsteedConnect With a Mentor Commented:
This isn't exactly what your looking for but it does blank out the password entry.

# Turn off echo
stty -echo
echo -n "Enter Password: "
read password
stty echo

The last line turns the echo back on.

Cheers,
Gary
0
 
manish_regmiConnect With a Mentor Commented:
How about using expect.

expect -re "Password '.*': "

http://expect.nist.gov/

regards
Manish Regmi
0
 
veedarAuthor Commented:
Thanks, blanking it out will work for me.

And a relevant expect doc here....
http://expect.nist.gov/doc/bgpasswd.pdf
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.