mac下find命令的使用

在mac下面想查找某个文件夹下的所有.md文件:

find -name '*.md'

在mac上报如下错误:
find: illegal option -- n

在stackoverflow上找到了答案(https://stackoverflow.com/questions/25840713/illegal-option-error-when-using-find-on-macos):
  • mac上使用的是bsd,而linux上使用的是gnu
  • bsd的find命令第一个参数必须指定目录路径,而gnu可以省略第一个参数
【mac下find命令的使用】所以,上面的命令在linux执行完全没问题,而在mac下必须使用:
find . -name '*.md'

    推荐阅读