小编Ben*_*ann的帖子

OSX 命令 find -type f -exec file {} \: 不工作

我正在尝试编写更改没有 DOS 行结尾的文件的脚本,以将它们更改为具有 DOS 行结尾,但是我对如何定位不包含 DOS 行结尾的文件感到困惑。

我有以下适用于 linux 的命令

$ find -type f -exec file {} \; | grep -v CRLF 
Run Code Online (Sandbox Code Playgroud)

它工作并返回

./test/test.bat: ASCII text
Run Code Online (Sandbox Code Playgroud)

但是,在 OSX 上我得到

$ find -type f -exec file {} \; | grep -v CRLF
find: illegal option -- t
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
Run Code Online (Sandbox Code Playgroud)

我也试过

$ find . -type f -exec file {} …
Run Code Online (Sandbox Code Playgroud)

macos bash find

3
推荐指数
1
解决办法
3061
查看次数

标签 统计

bash ×1

find ×1

macos ×1