我想列出以字母“R”结尾的文件。在 macOS 终端中,我使用如下所示的
但我收到了一条消息,上面写着
find
命令:find -type f -name '*R'
但我收到了一条消息,上面写着
非法选项--t
。find
的第一个参数是开始查找的路径。路径.
表示当前目录。
The first argument to find
is the path where it should start looking. The path .
means the current directory.find . -type f -name '*R'
您必须至少提供一条路径,但实际上您可以提供任意多条路径:
find ~/Documents ~/Library -type f -name '*R'
gnu find
将默认为.
。Mac OS 默认使用bsd
,如果您没有为-f
提供参数,则需要一个参数。如果使用类似于“必须提供至少一个路径”的语句而不指定find
的版本,很可能会导致更多的混淆。 - Reinstate Monica Please