在mac下面想查找某個(gè)文件夾下的所有.md
文件:
find -name '*.md'
在mac上報(bào)如下錯(cuò)誤:
find: illegal option -- n
在stackoverflow上找到了答案(https://stackoverflow.com/questions/25840713/illegal-option-error-when-using-find-on-macos):
- mac上使用的是
bsd
,而linux上使用的是gnu
。 - bsd的find命令第一個(gè)參數(shù)必須指定目錄路徑,而gnu可以省略第一個(gè)參數(shù)
所以,上面的命令在linux執(zhí)行完全沒問題,而在mac下必須使用:
find . -name '*.md'