Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Write shell script to implement terminal locking (similar to lock command). It should prompt the user for password. After accepting the password entered by the user, it must prompt again for matching password as confirmation and if match occurs, it must the lock the keyboard until a matching password is entered again by the user, Note that the script must be written to disregard BREAK, control-D. No time limit need be implemented for the lock duration.in
- #!/bin/sh
- clear
- f=1
- echo -e "Enter password: \c"
- read -s password1
- echo -e "\nRe-enter password: \c"
- read -s password2
- if [ $password1 == $password2 ]; then
- echo -e "\n\nMatch found"
- else
- while [ 1 ]
- do
- if [ $f -eq 3 ]; then
- echo -e "\n\nWrong password"
- exit
- else
- echo -e "\n\nEnter password: \c"
- read -s password1
- echo -e "\nRe-enter password: \c"
- read -s password2
- if [ $password1 == $password2 ]; then
- echo -e "\n\nMatch found"
- exit
- fi
- f=`expr $f + 1`
- fi
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement