bash 在 macOS 上使用 find 时出现“非法选项”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25840713/
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-18 11:21:39  来源:igfitidea点击:

"Illegal option" error when using find on macOS

macosbashshellunixfind

提问by Gravity M

I am trying to list the files only with the letter "R" at the end. I used findas follows in macOS Terminal,

我试图仅以字母“R”结尾列出文件。我find在 macOS 终端中使用如下,

find -type f -name '*R' 

But I got the message saying illegal option --t.

但我收到消息说illegal option --t

回答by rob mayoff

The first argument to findis the path where it should start looking. The path .means the current directory.

第一个参数find是它应该开始寻找的路径。路径.表示当前目录。

find . -type f -name '*R'

You must provide at least one path, but you can actually provide as many as you want:

您必须至少提供一条路径,但实际上您可以提供任意数量的路径:

find ~/Documents ~/Library -type f -name '*R'