From 8f6cd793a5c86edea1bce6ae14907e56a868e7ed Mon Sep 17 00:00:00 2001 From: solo Date: Fri, 11 Feb 2022 09:25:58 -0500 Subject: [PATCH] Fix #304 Fixes #304 by checking if the alias already exists before applying it. --- lib/bourne-shell.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/bourne-shell.sh b/lib/bourne-shell.sh index 3a09618e6..81356cb43 100644 --- a/lib/bourne-shell.sh +++ b/lib/bourne-shell.sh @@ -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