TTY=`tty`
SAVEDSTTY=`stty -g`
echo -n "Enter your password to lock $TTY: "
stty -echo
read PASSWORD
while :
do
read ANS <$TTY
if [ "$PASSWORD" = "$ANS" ]
then
echo "unlock..."
break
else
echo "The password is invalid, the terminal is locked..."
fi
done