Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes ohmybash#304 by checking if the alias already exists before applying it.
  • Loading branch information
solonovamax authored Feb 11, 2022
1 parent 92b4c30 commit 8f6cd79
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/bourne-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,25 @@ esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
if ! alias ls >/dev/null 2>&1; then
alias ls='ls --color=auto'
fi
#if ! alias dir >/dev/null 2>&1; then
# alias dir='dir --color=auto'
#fi
#if ! alias vdir; then
# alias vdir='vdir --color=auto'
#fi

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
if ! alias grep >/dev/null 2>&1; then
alias grep='grep --color=auto'
fi
if ! alias fgrep >/dev/null 2>&1; then
alias fgrep='fgrep --color=auto'
fi
if ! alias egrep >/dev/null 2>&1; then
alias egrep='egrep --color=auto'
fi
fi

# colored GCC warnings and errors
Expand Down

0 comments on commit 8f6cd79

Please sign in to comment.