很多时候我们不能一直守护在自己的电脑旁边,而且有些文件并不想让别人知道。那么这时候来个锁屏,是再合适不过的了。今天分享一个自制的锁屏工具,如下。
准备
"color: #800000"> "color: #800000"> "htmlcode">
#!/bin/bash #scriptname:locktty #writed by :Marksinoberg #description : just for protecting our message when we leave away. And we can set the password every time. reset;clear #清除屏幕 info="Please input the password you will use later!" cowsay $info read mypassword echo "Screen will locked in 7 seconds!" sleep 7 clear #!/bin/bash #scriptname:locktty #writed by :javalee #script start... reset;clear #清除屏幕 info="Please input the password you will use later!" cowsay $info read mypassword echo "Screen will locked in 7 seconds!" sleep 7 clear #加上这个倒记时的小东东,;) trapper () { #建立个函数 trap ' ' 2 3 20 #忽略CTRL+C CTRL+\ CTRL+Z信号 } while : #进入死循环 do trapper #调用函数 printf "\n\n\n\n\n\n\n\n\t\t\tPlease enter unlock code:" | cowsay stty -echo #屏蔽输入的字符 read input case $input in $mypassword) printf "\t\t Hello $USER,Today is $(date +%T)\n" stty echo break ;; #输入正确,挑出循环回到命令行 *)echo "Do not check my files,please! See as follows:" sleep 3 clear continue ;; #否则,继续循环 esac done
运行演示
程序运行开始:
mark@mark:~/temp/myscripts$ ./lockscreen.sh
______________________________________
/ Please input the password you \
\ will use later! /
--------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
123
Screen will locked in 7 seconds!
由于静态文本没办法显示程序执行过程中的动态效果,所以直接看解锁界面吧
当我们输入不正确的密码的时候,系统会提示输入错误,以及一个幽默的“警告”
___________________________
/ \
\ Please enter unlock code: /
---------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Do not check my files,please! See as follows:
_________________________________________
/ Q: Why is it that the more accuracy you \
| demand from an interpolation |
| |
| function, the more expensive it becomes |
| to compute"color: #800000"> ___________________________
/ \
\ Please enter unlock code: /
---------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Hello mark,Today is 06:35:05
结语
代码还是很简单的,仅仅用到了shell脚本语法的几个小命令。希望我这个脚本能抛砖引玉,打开你的思路,做出更好的锁屏小脚本!
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]