Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrites ls alias #304

Closed
solonovamax opened this issue Feb 11, 2022 · 0 comments · Fixed by #305
Closed

Overwrites ls alias #304

solonovamax opened this issue Feb 11, 2022 · 0 comments · Fixed by #305

Comments

@solonovamax
Copy link
Contributor

oh-my-bash currently overrides any aliases that has been set for ls, if /usr/bin/dircolors exists.

This happens because of lines 61 to 70 in $OSH/lib/bourne-shell.sh.

An alternative for this would be to do

if [ -x /usr/bin/dircolors ]; then
  test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  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

  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

This will only set the aliases if they don't already exist.

Will submit PR in a few.

solonovamax added a commit to solonovamax/oh-my-bash that referenced this issue Feb 11, 2022
Fixes ohmybash#304 by checking if the alias already exists before applying it.
akinomyoga pushed a commit to solonovamax/oh-my-bash that referenced this issue Jul 3, 2022
)

Fixes ohmybash#304 by checking if the alias already exists before applying it.
mqcmd196 pushed a commit to mqcmd196/oh-my-bash that referenced this issue Sep 3, 2022
)

Fixes ohmybash#304 by checking if the alias already exists before applying it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant