Calcifer Calcifer 2 Calcifer 3 Calcifer 4
Linux

查找目录下的执行可脚本

2017/11/01 01:00 5988 次阅读 王梓
打赏
✸ ✸ ✸
find -L . -name \*.sh -o -name \*.py -o -name \*.pl
 
./misc/smaps.pl
./misc/switch_inet.sh
./misc/ini_parse.pl
./misc/parse_agent_value.pl
./misc/show_process_of_USER.pl
./pkgtools/mkpkg.sh
-o =or
-a =and
-L 追踪所有符号链接
find命令的一般格式为:
find [-H] [-L] [-P] [path...] [expression]
其中,'-H' '-L' '-P'三个选项主要是用来处理符号连接,'-H'表示只跟随命令行中指定的符号连接,'-L'表示跟随所有的符号连接,'-P'是默认的选项,表示不跟随符号连接。

例如,在我的当前目录下有一个符号连接e1000,现在我想查找文件名中最后一个字母是数字的源文件,那么
$ find -H . -name "*[0-9].c" -print

./2234.c
像上面这样写只能查找出当前目录下符合要求的文件,却找不出e1000下的文件。因此可以这么写:
$ find -H e1000 . -name "*[0-9].c" -print

或者使用 '-L'选项
$ find -L . -name "*[0-9].c" -print
✸ ✸ ✸

📜 版权声明

本文作者:王梓 | 原文链接:https://www.bthlt.com/note/1698585-Linux���������������������������������

出处:葫芦的运维日志 | 转载请注明出处并保留原文链接

📜 留言板

留言提交后需管理员审核通过才会显示