executing man diff
tells the following:
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.
[...]
but when I use the -q
option, it fails with fatal: invalid diff option/value: -q
Why does the man of the diff command do not correspond to the version installed?
How to fix it?
Is there a brew package who has a version of the diff command with the -q
option?
(brew coreutils and binutils do not have the diff command)
OSX 10.11.5
Update with your questions
$ 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
I use brew and https://github.com/donnemartin/dev-setup
If I disable the .bash_profile
installed by dev-setup, then which diff
still returns the same path but diff -q
works.
Do you, by any chance, use anything like pretzo or something similar? Some frameworks like this will (badly) define their own functions replacing the terminal default ones.
In that case, try running command diff -q ...
and see if this resolves the issue.
Edit: As @MarkPlotnick pointed out, dev-setup is another framework that overrides the default diff
command and uses git diff
instead:
# Use Git’s colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@";
}
fi;
Reference: https://github.com/donnemartin/dev-setup/blob/master/.functions