设为首页 加入收藏

TOP

感受Linux下强大shell编程
2014-11-23 23:35:20 来源: 作者: 【 】 浏览:7
Tags:感受 Linux 强大 shell 编程

The net of our school is so poor, so if you want to download something or update your system, you have to do these things late at night, even throughout the night. "Throughout the night" is popular in the linuxer in our school.


前天晚上,或者说是昨天凌晨,我用迅雷下载一个东西的时候,同学过来说你怎么还不睡觉。我说,等他下完了我就睡,结果他上来点了一下迅雷上的“自动关机”,用了这么久迅雷还不知道有这功能。


从来都没有脚步语言基础的我开始了一个新的旅程,一搜,找到一段很简单的源代码。


恩,根据一个月的Linux经验,我觉得应该是这样的,于是就开始了。


$:vim shutdown.sh


Then copy the source code to this fie.......


"while(ps -A|grep $5879) do sleep 2; done;
halt"


The 5879 is the PID of the process which I want to deal with.


然后保存,退出。


$ls


出现的shutdown.sh并不是彩色的,表明不能执行。


恩,好办,修改权限就可以了


$chmod u+x shutdown.sh
$ls


这次变成彩色的了,搞定。


$./shutdown.sh


哈哈,成功了,他开始不断的扫描这个进程是否结束。


第二天起来,哈哈,完全成功,第一次接触shell编程,很顺利。


我要学习shell了,他是个好东西。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇KDE性能提升建议 下一篇Linux系统下强制关闭程序

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: