2014年11月4日

Linux_C 输入输出重定向

摘要: 将stdin定向到文件有3种方法:1.close then open .类似挂断电话释放一条线路,然后再将电话拎起来从而得到另一条线路。 先close(0);将标准输入关掉,那么文件描述符数组中的第一个元素处于空闲状态。(一般数组0=stdin, 1=stdout, 2=stderror,如果不关... 阅读全文

posted @ 2014-11-04 22:58 Zachary_wiz 阅读(4483) 评论(0) 推荐(0) 编辑

Linux_C dup()

摘要: 1 /* 2 * stdinredir2.c 3 * shows two more methods for redirecting standard input 4 * use #define to set one or the other 5 */ 6 #include 7 #incl... 阅读全文

posted @ 2014-11-04 21:58 Zachary_wiz 阅读(359) 评论(0) 推荐(0) 编辑

Linux_shell comm

摘要: 希望编写一个程序,当其他用户登录系统或者注销时通知你。需要用到的命令:who, sort, commshell code 1 who | sort > prev 2 while true ; do 3 sleep 60 4 who | sort > curr 5 echo "... 阅读全文

posted @ 2014-11-04 21:53 Zachary_wiz 阅读(194) 评论(0) 推荐(0) 编辑

导航