blob: 559b5e096edef0d81e2c46f4243d5394dae62c43 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# Define function wrapper for grep(1) with --color option if GREP_COLORS is
# set; checks that color is available in the terminal within the function
if [[ $GREP_COLORS ]] ; then
grep() {
local -i colors=$(tput colors 2>/dev/null)
if ((colors >= 8)) ; then
command grep --color "$@"
else
command grep "$@"
fi
}
fi
|