blob: be2017419f4a328601bc1cf8708f7a4b55e638a2 (
plain) (
tree)
|
|
# 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 [[ ! -n $GREP_COLORS ]] ; then
return
fi
# Define function proper
grep() {
local -i colors
colors=$( {
tput Co || tput colors
} 2>/dev/null )
if ((colors >= 8)) ; then
command grep --color=auto "$@"
else
command grep "$@"
fi
}
|