Linux scripting: hiding user input on terminal

I have bash script like the following:


echo "Please enter your username";
read username;

echo "Please enter your password";
read password;

I want that when the user types the password on the terminal, it should not be displayed (or something like *******) should be displayed). How do I achieve this?




Just supply -s to your read call like so:

$ read -s PASSWORD
$ echo $PASSWORD

Need Your Help

How to update Jre and Jdk

java eclipse ubuntu

I am trying the try with resource statement: