diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2012-05-15 14:28:02 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2012-05-15 14:28:02 +1200 |
commit | 3edecc2e6d659bebdf74c7d5734d1c8357f76af2 (patch) | |
tree | 2a238a4429c34fc2a32a274eb791a19580a419d5 /bash | |
parent | Updated Fugitive. (diff) | |
download | dotfiles-3edecc2e6d659bebdf74c7d5734d1c8357f76af2.tar.gz dotfiles-3edecc2e6d659bebdf74c7d5734d1c8357f76af2.zip |
Slightly more elegant grep/ls colouring
Mostly just improving the readability of the conditional logic a bit.
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bash/bashrc b/bash/bashrc index 0f280084..169c6690 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -37,11 +37,13 @@ PS1='\u@\h:\w\$ ' PS2='...' # Use colors for ls and grep, if available. -if hash dircolors &>/dev/null; then +if ls --help | grep -q -- --color && hash dircolors &>/dev/null; then eval "$(dircolors -b)" - ls --help | grep -q -- --color && alias ls='ls --color=auto' + alias ls='ls --color=auto' +fi +if grep --help | grep -q -- --color; then + alias grep='grep --color=auto' fi -grep --help | grep -q -- --color && alias grep='grep --color=auto' # Use completion, if available. if [ -e /etc/bash_completion ]; then |