Today One BE final year student just asked me this one on IM, for his benefit and anyone who might want to have a password wrapper(if at all!!) here it is how to do the same via a shell script,
#!/bin/sh
###This is a simple bash screipt to read password###
######without echoing the same on console#####
actual="deburocks!"
failed=0
while [ $failed -le 3 ]
do
read -s -p "Password: " userpasswd
echo ""
if [ "$userpasswd" == "$actual" ]
then
echo "Password accepted"
read
exit 1
else
echo "Sorry! Wrong password, Try again..!!"
fi
failed=$(( $failed + 1 ))
done
Please remember - 'stty' can also do the trick as below:
stty -echo
read password
stty echo
Enjoy!!
Subscribe to:
Post Comments (Atom)
Expand your network at ease : Six Degrees of Separation! PC: Psych2Go Did you know that you are just six connections away from any person ...
-
Why I started blogging... Well, this is the ultimate question I get asked when I tell people I started a blog! I have taken a lot of time to...
-
I worked with a start up employer where it happened that we got an email from out Top Boss! to block all google and yahoo cousins, to promot...
-
Just couple of days back I wrote a post on IE9 beta release . I saw it buggy and was wondering if some of you has problem uninstalling this ...
No comments:
Post a Comment