bash 查找以 .sh 或 .bin 结尾的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4040313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 19:49:11 来源:igfitidea点击:
Find file ending with .sh OR .bin
提问by Manuel Selva
How can I find all the files ending with .sh OR .bin in a given folder.
如何在给定文件夹中找到所有以 .sh 或 .bin 结尾的文件。
I know I can do:
我知道我可以做到:
find /path/to/folder -name "*.bin"
to find all bin file. What must I add to also look for .sh files ?
找到所有bin文件。我必须添加什么才能查找 .sh 文件?
回答by Benoit
The manual page tells you that -o
is the OR operator. If you want case insensitivity, use iname
instead of name
.
手册页告诉您这-o
是 OR 运算符。如果您想要不区分大小写,请使用iname
代替name
。
find /path/to/folder -iname "*.bin" -o -iname "*.sh"