#! /bin/bash
flash_box() {
dialog --infobox $1 5 50
sleep .1
}
console_login()
{
data=/tmp/_dta$$$
# trap it
trap "rm -f $data" 0 1 2 5 15
# get password
dialog --title "Password" \
--clear \
--insecure \
--passwordbox "Enter your password" 10 30 2> $data
ret=$?
# make decision
case $ret in
0)
if [ "$(cat $data)" == "chetanMbetter" ] ;then
rm -rf /tmp/chetu
exec bash
else
if [ "$(cat $data)" == "" ] ;then
flash_box Password_empty
sleep 2
else
flash_box Invalid_password
sleep 2
fi
touch /tmp/chetu
fi
;;
*)
main_menu
;;
esac
}
console_login
# save above script as /usr/bin/anyname.sh
No comments:
Post a Comment