免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1230 | 回复: 1
打印 上一主题 下一主题

同样的命令grep 有的目录能够得到文件属性,有的就不可以? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-08-13 09:55 |只看该作者 |倒序浏览
为什么会这样?同样的命令grep -s echo
有的能够得到文件属性,有的就不可以?

[root@redhat73 virus]# grep -s echo /bin/*
Binary file /bin/ash matches
Binary file /bin/ash.static matches
Binary file /bin/bash matches
Binary file /bin/bash2 matches
Binary file /bin/bsh matches
Binary file /bin/csh matches
Binary file /bin/echo matches
Binary file /bin/ex matches
Binary file /bin/gettext matches
/bin/igawk:    echo "$0 needs mktemp to create temporary files."
/bin/igawk:    -f)     echo @include "$2" >> $STEMPFILE
/bin/igawk:    -f*)    f=`echo "$1" | sed 's/-f//'`
/bin/igawk:            echo @include "$f" >> $STEMPFILE ;;
/bin/igawk:            f=`echo "$1" | sed 's/-.file=//'`
/bin/igawk:            echo @include "$f" >> $STEMPFILE ;;
/bin/igawk:            echo @include "$2" >> $STEMPFILE
/bin/igawk:            t=`echo "$1" | sed 's/-.source=//'`

/bin/igawk:            echo "$t" >> $STEMPFILE ;;
/bin/igawk:            echo "$2" >> $STEMPFILE
/bin/igawk:            echo igawk: version 1.0 1>&2
/bin/igawk:         echo igawk: no program! 1>&2
/bin/igawk:        echo "$1" > $STEMPFILE
Binary file /bin/mail matches
Binary file /bin/netstat matches
Binary file /bin/rpm matches
Binary file /bin/rvi matches
Binary file /bin/rview matches
Binary file /bin/sh matches
Binary file /bin/stty matches
Binary file /bin/tcsh matches
Binary file /bin/vi matches
Binary file /bin/view matches
[root@redhat73 virus]# grep -s echo ./*
[root@redhat73 virus]# file ./*
./ls:       ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
./mv:       ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
./test:     Bourne shell script text executable
./virus.sh: ASCII text

论坛徽章:
0
2 [报告]
发表于 2003-08-13 13:12 |只看该作者

同样的命令grep 有的目录能够得到文件属性,有的就不可以?

grep -s echo ./*
是把当前目录下所有文件中 包含 echo 的行给显示出来吧?

如果没有包含 echo 的行,文件就不显示了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP