Saturday, February 27, 2010

TERMINAL LOCKING SHELL SCRIPT

#!/bin/bash
#Terminal locking
#
stty -icanon
stty -isig
echo "Enter the password to achieve Terminal locking"
stty -echo
read name
stty echo
echo "Retype the password for confirmation"
stty -echo
read name1
stty echo
if [ $name=$name1 ] ; then
echo "Password Matched successfully"
stty -echo
echo "Terminal Locked"


else
echo "Passwords dont match"
exit 0
fi
while [ 10 ] ;
do
echo "Enter the password for Unlocking"
stty -echo
read da
stty echo
if [ $da=$name ] ; then
stty echo
echo "Successfully Unlocked the terminal"
exit 0
else
echo "Wrong password entered Unable to Unlock"
stty -echo
fi
done

No comments: