From bbb90adedd09ff672a6c3302023abeefd40b7f5f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 20 Dec 2012 21:39:06 +0100 Subject: [PATCH] shell/aliases: Use grep --color=auto if available. --- setup.sh | 9 +++++++++ shell/aliases.in | 3 +++ 2 files changed, 12 insertions(+) diff --git a/setup.sh b/setup.sh index be42a6a..3a43c3a 100755 --- a/setup.sh +++ b/setup.sh @@ -102,6 +102,15 @@ generate perl shell/aliases \ }' \ "$ls_env" "$ls_path" "$ls_color" +# Check if grep supports --color=auto. +if echo test | grep --color=auto test >/dev/null 2>&1; then + : +else + echo 'shell/aliases: removing grep --color=auto' + sed '/^alias grep=/ s/^/#/' shell/aliases > shell/aliases.tmp + mv shell/aliases.tmp shell/aliases +fi + generate cat screenrc .in # As screen-256color is not widely supported use it only on machines where the # matching terminfo entry is available. This also requires a terminal emulator diff --git a/shell/aliases.in b/shell/aliases.in index fa76162..c7e234e 100644 --- a/shell/aliases.in +++ b/shell/aliases.in @@ -79,6 +79,9 @@ alias du='du -shc' # Use human readable sizes. alias df='df -h' +# Highlight matched strings. Doesn't work with a pager! +alias grep='grep --color=auto' + # Edit the mercurial patch queue series file for the current mercurial # repository in Vim. Also change Vim's pwd to the patches directory so other # patches can easily be opened. -- 2.45.2