<tt>stty -echo</tt>: Passwords



next up previous contents
Next: cutawk: Cut Up: Tips Using Shell Previous: dirname: Directory Path

stty -echo: Passwords

If the script requires the input of a ``secret" string, the string typed from the keyboard should not be displayed on the screen. To stop the display of the characters typed,

stty -echo
may be used.

To resume echoing of the characters,

stty echo
is used.

#!/bin/sh
echo "Please enter your passcode: \c"
stty -echo
read PASSCODE
stty echo
echo "The passcode was not seen when typed."



Super-User
Fri Feb 17 15:55:40 EST 1995