Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Simple user-interaction based login script
- username="root"
- password="toor"
- #set -x #tracing code line on
- echo "You have 10 sec to type"
- echo -n "username > "
- if read -t 10 response; then
- if [ $response = $username ]; then
- echo "hello $username"
- echo -n "password > "
- else
- echo "user not found"
- exit
- fi
- if read -s -t 10 response; then
- if [ $response = $password ]; then
- echo "login success"
- # This line is where the actual magic starts
- echo "logging out."
- else
- echo "wrong password"
- fi
- else
- echo "Sorry! too slow"
- echo "You should type credendials in 10 sec"
- fi
- else
- echo "Sorry! Too slow!"
- echo "Session timed out"
- fi
- #set +x #tracing code line off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement