Start password for Shell application programming. Welcome to welcome.
Description: If you want to lock access to the terminal but do not want to exit and log on again, you can write a script.Program.
When the script is called, you can exit only after you have entered the correct password.
Where:CTRL + u Delete the entire row
CTRL + B Delete the previous character
Characters in bold
Shell Process source sequence:
Trap "" 2 3 4 stty-echo # tput belstty kill \ ^ ustty erase \ ^ btput bold # tput blinktput Bel # tput dimif [$ #-GT 0] Then mesg = "$ @ "else mesg =" this system is locked "fitput cleartput cup 5 10; echo "Enter your passwd> \ c" read pword_1tput cleartput Cup 10 20; echo "$ mesg" pword_2 = until ["$ pword_1" = "$ pword_2"] Do tput rev read pword_2donestty echotput clearexit 0
Analysis: capture the signal through trap, and set the interrupt signal and exit signal to be blocked. That is, the CTRL + C, Del, and break keys do not work.