LDP/LDP/guide/docbook/abs-guide/secret-pw.sh

30 lines
621 B
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2005-05-08 20:09:31 +00:00
# secret-pw.sh: secret password
2001-07-10 14:25:50 +00:00
echo
echo -n "Enter password "
read passwd
echo "password is $passwd"
echo -n "If someone had been looking over your shoulder, "
echo "your password would have been compromised."
echo && echo # Two line-feeds in an "and list."
2005-05-08 20:09:31 +00:00
2001-07-10 14:25:50 +00:00
2001-09-04 13:27:31 +00:00
stty -echo # Turns off screen echo.
2014-03-07 02:24:29 +00:00
# May also be done with
# read -sp passwd
# A big Thank You to Leigh James for pointing this out.
2001-07-10 14:25:50 +00:00
echo -n "Enter password again "
read passwd
echo
echo "password is $passwd"
echo
2001-09-04 13:27:31 +00:00
stty echo # Restores screen echo.
2001-07-10 14:25:50 +00:00
exit 0
2005-05-08 20:09:31 +00:00
# Do an 'info stty' for more on this useful-but-tricky command.