Merge pull request #885 from nwinkler/upstream-grep-color

Upstream grep color
pull/887/head
Nils Winkler 2017-01-09 18:16:23 +01:00 committed by GitHub
commit c519ff6b19
2 changed files with 15 additions and 7 deletions

View File

@ -1,9 +1,16 @@
cite about-alias
about-alias 'general aliases'
if ls --color -d . &> /dev/null
then
alias ls="ls --color=auto"
elif ls -G -d . &> /dev/null
then
alias ls='ls -G' # Compact view, show colors
fi
# List directory contents
alias sl=ls
alias ls='ls -G' # Compact view, show colors
alias la='ls -AF' # Compact view, show hidden
alias ll='ls -al'
alias l='ls -a'
@ -11,10 +18,15 @@ alias l1='ls -1'
alias _="sudo"
if [ $(uname) = "Linux" ]
# colored grep
# Need to check an existing file for a pattern that will be found to ensure
# that the check works when on an OS that supports the color option
if grep --color=auto "a" $BASH_IT/*.md &> /dev/null
then
alias ls="ls --color=auto"
alias grep='grep --color=auto'
export GREP_COLOR='1;33'
fi
which gshuf &> /dev/null
if [ $? -eq 0 ]
then

View File

@ -1,9 +1,5 @@
#!/usr/bin/env bash
# colored grep
alias grep='grep --color=auto'
export GREP_COLOR='1;33'
# colored ls
export LSCOLORS='Gxfxcxdxdxegedabagacad'