X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.profile.d%2Fgrep.bashrc;h=259be8d4935f34f31cb93b25a3753ef15e57bb49;hb=d6ccc8abb1b587d6c9e2b4f416c1236cc61e7c3c;hp=087282888ce07579ead7f7e6ddd9a58b7eef47d3;hpb=b82d709dee82b7e05ae8b9fa87e0eea488da6a3d;p=profile.git diff --git a/.profile.d/grep.bashrc b/.profile.d/grep.bashrc index 0872828..259be8d 100644 --- a/.profile.d/grep.bashrc +++ b/.profile.d/grep.bashrc @@ -1,3 +1,4 @@ +# profile-required: TERM.bashrc # Use colours for grep if possible. if grep -V 2>/dev/null | grep GNU >/dev/null; then alias grep='grep --color=auto' @@ -9,6 +10,7 @@ if grep -V 2>/dev/null | grep GNU >/dev/null; then # cx: Lines of context; sl: Matching lines; mt: Search string; fn: Filename # ln: Line number; bn: Byte offset; se: Separators. colours=$(tput colors 2>/dev/null) + [ -z "$colours" ] && colours=0 if [ $colours = 256 ]; then export GREP_COLORS='cx=38;5;246:sl=:mt=33:fn=38;5;25:ln=38;5;82:bn=33:se=38;5;246' elif [ $colours -gt 88 ]; then