Tag Info

Hot answers tagged

2

If you have access to GNU diff you can use its --X-group-format options to get that effect without any additional tools: diff --old-group-format=$'\e[0;31m%<\e[0m' \ --new-group-format=$'\e[0;31m%>\e[0m' \ --unchanged-group-format=$'\e[0;32m%=\e[0m' \ file1 file2 That uses ANSI colour escape codes to get red and green, with ANSI-C ...


1

If you want to test that one of these variables is not 0, then you need || operator. Not &&. $ if [[ 1 -ne 0 && 0 -ne 0 && 0 -ne 0 ]] ; then echo "There is something terribly wrong."; fi $ if [[ 1 -ne 0 || 0 -ne 0 || 0 -ne 0 ]] ; then echo "There is something terribly wrong."; fi There is something terribly wrong.



Only top voted, non community-wiki answers of a minimum length are eligible