转自:http://blog.chinaunix.net/uid-9525959-id-2001528.html printf FORMAT [ARGUMENT]... printf OPTION [功能] 格式化并打印数据. [举例] *打印整数和字符串: $printf 'the integer is:%d\nthe string is: %s\n' 3 "test" 输入之后,输出如下: the integer is:3 the string is: test 这里,使用单引号双…
分类: LINUX 参考资料:http://sns.linuxpk.com/space-566-do-blog-id-15819.html printf FORMAT [ARGUMENT]... printf OPTION [功能] 格式化并打印数据. [举例] *打印整数和字符串: $printf 'the integer is:%d\nthe string is: %s\n' 3 "test" 输入之后,输出如下: the integer is:3 the string is: t…
Linux下who命令之C语言实现 Step1:前期准备 首先要有一个清楚的认识:linux中一切皆文件 实现who命令,who命令也是Linux中的一个文件,那我们怎么找到它呢?我们可以"找男人"(man),终端下执行命令:man who 此处我装了汉译版的man手册,查看到这样一段提示如下: 所以退出man手册,执行命令:info who 找到如下图相关信息: 也可以找到下面这样的一段话,也就是说:who命令可以这样实现,读取utmp里边的内容,然后显示记录,最后关闭utmp,wh…