shell脚本
文章平均质量分 69
dongxie_tk
性格开朗、兴趣广泛、喜欢三五好友旅游、热衷爬山
展开
-
shell脚本——判断文件的属性、内容、、
#!/bin/sh #文件路径 :/usr/local/1.txtread myfile1read myfile2#判断文件1是否存在if [ -e $myfile1 ]; then echo '文件存在'; #判断文件1是否为空 if [ -s $myfile1 ]; then echo '这个文件不为空';原创 2017-09-01 14:07:43 · 8282 阅读 · 0 评论 -
shell脚本——通过关键字查找文件路径
这个脚本是用来查找指定路径下,含有某个关键字的所有文件,并显示文件所在路径及文名。原创 2017-09-01 14:31:50 · 3532 阅读 · 0 评论 -
shell脚本——比较两个文件大小、权限
#!/bin/bash#创建文件/usr/local/1.txt、/etc/local/2.txt,分别给权限655、712#文件的字节数 、字数、行数wc /usr/local/1.txt >aa.txtwc /etc/local/2.txt >bb.txt#文件的大小du -h --max-depth=2 /usr/local/1.txt >>原创 2017-08-31 15:05:34 · 5660 阅读 · 0 评论 -
shell脚本——统计不同目录下同名文件个数
#!/bin/bash#遍历目录函数list_alldir(){ for road in `ls -a $1` do if [ x"$road" != x"." -a x"$road" != x".." ];then if [ -d "$1/$road" ];then echo "$1/$原创 2017-09-01 17:52:00 · 724 阅读 · 0 评论 -
shell脚本——不同目录下同名文件内容比较
#!/bin/bash#遍历目录函数list_alldir(){ for road in `ls -a $1` do if [ x"$road" != x"." -a x"$road" != x".." ];then if [ -d "$1/$road" ];then echo "$1/$原创 2017-09-01 17:54:15 · 2344 阅读 · 0 评论 -
shell脚本——比较不同目录下所有文件
#!/bin/bash#遍历目录函数list_alldir(){ for road in `ls -a $1` do if [ x"$road" != x"." -a x"$road" != x".." ];then if [ -d "$1/$road" ];then echo "$1/$原创 2017-09-01 18:03:08 · 1476 阅读 · 0 评论