0

i wonder if it is possible to "hide" the password in Linux Shell Script? for example, i have a code here

echo “Enter Password:"
read p
 
if [ $p = “Passwords" ]
then
    echo “Password Granted"
else
    echo "Password Denied"
fi

as you can see when im going to bash it at Linux Terminal, i will be asked to type/enter the password in line 2. in Linux Terminal, whatever you type, the characters are visible. if i type "passwords" or "passhwords" or any character, i can see visibly each character/letter of what i type there.

i wonder if it is possible to "hide" it? similar to Facebook or Google account login where when i type any character it will appear as "*****" instead of the actual characters. is there a code i should enter before "read p"(2nd line) so whatever i will type will be hidden?

OS: Ubuntu

0 Answers0