refactor(bash): clean up alias definitions

This commit is contained in:
Fernando Schauenburg 2020-12-11 12:18:07 +01:00
parent 003f6c2a14
commit ecad0a8d62

View file

@ -161,29 +161,27 @@ __ps1_set() {
# Customize shell aliases # Customize shell aliases
############################################################################## ##############################################################################
# Make `ls` group directories first if supported. # ls: make `ls` group directories first if supported.
if ls --group-directories-first &>/dev/null; then # lsc: force `ls` to use color output (e.g. for piping into `less`).
alias ls="ls -hF --group-directories-first --color=auto" # GNU if ls --group-directories-first --color=auto &>/dev/null 2>&1; then
# GNU ls
alias ls="ls -hF --group-directories-first --color=auto"
alias lsc="ls --color=always"
else else
alias ls="ls -hF -G" # BSD # BSD ls (e.g. macOS)
fi alias ls="ls -hF -G"
alias lsc="/usr/bin/env CLICOLOR_FORCE=1 ls"
# Force `ls` to use color output (e.g. for piping into `less`).
if ls --color=auto &>/dev/null; then
alias lsc="ls --color=always" # GNU
else
alias lsc="/usr/bin/env CLICOLOR_FORCE=1 ls" # BSD
fi fi
alias la="ls -a" alias la="ls -a"
alias ll="ls -l" alias ll="ls -l"
alias llc="lsc -l"
alias lla="ls -la" alias lla="ls -la"
alias llc="lsc -l"
alias llac="lsc -la" alias llac="lsc -la"
alias grep="grep --color=auto"; alias grep="grep --color=auto"
alias egrep="egrep --color=auto"; alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"; alias fgrep="fgrep --color=auto"
alias path='echo $PATH | tr -s ":" "\n"' alias path='echo $PATH | tr -s ":" "\n"'
alias mpath='echo $MANPATH | tr -s ":" "\n"' alias mpath='echo $MANPATH | tr -s ":" "\n"'
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'