执行man diff说明如下:
NAME
diff - compare files line by line
SYNOPSIS
diff [OPTION]... FILES
DESCRIPTION
Compare files line by line.
-i --ignore-case
Ignore case differences in file contents.
[...]
-q --brief
Output only whether files differ.
[...]但是当我使用-q选项时,它会在fatal: invalid diff option/value: -q中失败
为什么diff命令的执行人员与安装的版本不相对应?
怎么修呢?
是否有一个brew包具有带有-q选项的diff命令的版本?(brew coreutils和binutils没有diff命令)
OSX 10.11.5
用你的问题更新
$ which diff
/usr/bin/diff
$ diff --version
usage: git diff --no-index <path> <path>
$ diff -v
usage: git diff --no-index <path> <path>
$ command diff --version
diff (GNU diffutils) 2.8.1我用brew和https://github.com/donnemartin/dev-setup
如果我禁用由开发安装安装的.bash_profile,那么which diff仍然返回相同的路径,但diff -q工作。
发布于 2016-05-31 00:01:27
你是否有机会使用类似奇佐之类的东西?有些框架将(很糟糕)定义它们自己的函数,以取代终端默认的函数。
在这种情况下,尝试运行command diff -q ...,看看这是否解决了问题。
编辑:正如@MarkPlotnick所指出的,发展-设置是另一个覆盖默认diff命令并使用git diff的框架:
# Use Git’s colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@";
}
fi;参考:https://github.com/donnemartin/dev-setup/blob/master/.functions
https://stackoverflow.com/questions/37534776
复制相似问题