摘要:
原文 http://blog.zol.com.cn/2322/article_2321774.html#cat /proc/meminfo | grep "MemFree" | awk '{print $2}' (用来查看free的内存有多少)之前先了解一下内存的基本知识#free -mtotal used free shared buffers cachedMem: 1002 769 232 0 62 421-/+ buffers/cache: 286 715Swap: 1153 0 1153第一部分Mem行:total 内存总数: 1002Mused 已
阅读全文
posted @ 2014-01-03 17:35
c3tc3tc3t
阅读(308)
推荐(0)
编辑
摘要:
原文 http://blog.zol.com.cn/2322/article_2321767.html功能强大的shell:if条件语句 if语句测试条件,测试条件返回真(0)或假(1)后,可相应执行一系列语句。if语句结构对错误检查非常有用。其格式为:if 条件1then 命令1elif 条件2then 命令2else 命令3fi–b 当file存在并且是块文件时返回真 -c 当file存在并且是字符文件时返回真 -d 当pathname存在并且是一个目录时返回真 -e 当pathname指定的文件或目录存在时返回真 -f 当file存在并且是正规文件时返回真 -g 当由pathname指定
阅读全文
posted @ 2014-01-03 17:34
c3tc3tc3t
阅读(233)
推荐(0)
编辑
摘要:
原文 http://blog.zol.com.cn/2322/article_2321763.html$( ) 与 ` ` (反引号)在 bash shell 中,$( ) 与 ` ` (反引号) 都是用来做命令替换用(command substitution)的。所谓的命令替换与我们第五章学过的变量替换差不多,都是用来重组命令行:* 完成引号里的命令行,然后将其结果替换出来,再重组命令行。例如:[code]$ echo the last sunday is $(date -d "last sunday" +%Y-%m-%d)[/code]如此便可方便得到上一星期天的日期了
阅读全文
posted @ 2014-01-03 17:32
c3tc3tc3t
阅读(312)
推荐(0)
编辑
摘要:
转自 ttp://blog.csdn.net/security134/article/details/6742156最近学习SHELL编程 这篇文章很好很重要。有些东西不能想当然。同时不是表面看起来那么简单。以为自己懂了。其实差的还远Cuibtoy发布于 2008-8-28 http://www.linuxdiyf.com/viewarticle.php?id=105505我打赌正在看这篇文章的你, 超过99%的可能性你对这个问题的理解是错的. 或者至少是有偏差的.我深信这是一种教育法上的广泛错误, 那就是告诉大家说:if [ condition ]then...fi这是bash中条件语句的.
阅读全文
posted @ 2014-01-03 16:27
c3tc3tc3t
阅读(264)
推荐(0)
编辑