updated to clean up compiler issues with how functions were used from basis namespace;
[feisty_meow.git] / scripts / tty / lockup.sh
1 #!/bin/bash
2
3 # Thanks to Kevin Wika for this shell.
4
5 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
6
7 trap '' HUP
8 trap '' INT
9 trap '' QUIT
10 trap '' STOP
11 trap '' EXIT
12 trap '' TSTP
13
14 PASSWORDFILE=$TMP/lockup_password_file
15 LOGFILE=$TMP/lockup.log
16
17 read password <$PASSWORDFILE
18
19 echo "$(date_stringer): terminal locked" >>$LOGFILE
20
21 attempt=""
22
23 stty -echo
24 while [[ $attempt != $password ]]
25   do
26     if [ ! -z "$attempt" ]; then
27       echo "$(date_stringer): $attempt" >>$LOGFILE
28     fi
29     clear
30     echo -n "password: "
31     read attempt
32   done
33 stty echo
34
35 echo -e "$(date_stringer): successful login\n" >>$LOGFILE
36
37 clear
38 echo "Your Password has been Accepted."