I am new to shell scripting . i want to make the password not visible when we type password ..can you please suggest me on this
echo "enter your password"
read pass
if [ "$pass" != "" ]
then
echo "thank you "
else
echo "invalid password"
exit
fi
I am new to shell scripting . i want to make the password not visible when we type password ..can you please suggest me on this
echo "enter your password"
read pass
if [ "$pass" != "" ]
then
echo "thank you "
else
echo "invalid password"
exit
fi
Alternatively, if you issue in your bash prompt:
help read
You will find out that you can use a switch.
-s do not echo input coming from a terminal
Thus simply using read -s pass will solve your problem.
Use
# turn echo off
stty -echo
...
# turn echo back on
stty echo