shell
Q妞
静静做一枚技术中的女汉子
展开
-
shell 实例收集
1.查找当前目录中所有大于500M的文件,把这些文件名写到一个文本文件中,并统计其个数。find ./ -size +500M -type f | tee file_list | wc -l2.在目录/tmp下找到100个以abc开头的文件,然后把这些文件的第一行保存到文件new中。for filename in `find /tmp -type f -name "abc*"|转载 2015-11-17 09:53:49 · 271 阅读 · 0 评论 -
shell脚本--在文件中添加头文件
代码块#!/bash/bin #!filename=inbash.sh#查看文件是否含有#! count=`grep "^#!" $1 | wc -l`if [ ${count} == 0 ];then#定界符 EOF后的文件前面不能有空格cat >> $1 << EOF#!/bin/bash#author:#date: `date +"%Y-%m-%d"`#description原创 2017-02-23 16:34:21 · 7556 阅读 · 1 评论