(bashrc) changed which to command -v for better portability

This commit is contained in:
root committed 2026-10-09 09:10:32 +02:00
1 parent 1d7f75297d
commit fc3746cb53
1 file changed
+9 -9
+9 -9
View File
@@ -16,7 +16,7 @@ export HISTFILESIZE=${history_size}
# configure pagers # configure pagers
export PAGER='less --use-color -R' export PAGER='less --use-color -R'
if $(which nvim &>/dev/null); then if $(command -v nvim &>/dev/null); then
export MANPAGER='nvim +Man!' export MANPAGER='nvim +Man!'
alias vim='nvim' alias vim='nvim'
fi fi
@@ -31,13 +31,13 @@ fi
#bind -r "\C-l" #bind -r "\C-l"
# define aliases # define aliases
if ! $(which navigate &>/dev/null); then if ! $(command -v navigate &>/dev/null); then
alias push='pushd' alias push='pushd'
alias pop='popd' alias pop='popd'
alias stack='dirs -v' alias stack='dirs -v'
fi fi
if $(which eza &>/dev/null); then if $(command -v eza &>/dev/null); then
alias list='eza -lao --no-permissions --group-directories-first \ alias list='eza -lao --no-permissions --group-directories-first \
-s=ext --color=always --time-style long-iso' -s=ext --color=always --time-style long-iso'
alias tree='eza -laoT --no-permissions --group-directories-first \ alias tree='eza -laoT --no-permissions --group-directories-first \
@@ -47,7 +47,7 @@ else
fi fi
# aliases related to `grep` # aliases related to `grep`
if $(which ug &>/dev/null); then if $(command -v ug &>/dev/null); then
alias ugi='ug -j' alias ugi='ug -j'
fi fi
alias grep='grep --color=always' alias grep='grep --color=always'
@@ -56,14 +56,14 @@ alias bdiff='diff -uw --color=always'
alias sbash='source ~/.bashrc' alias sbash='source ~/.bashrc'
if $(which ip &>/dev/null); then if $(command -v ip &>/dev/null); then
alias ip='ip -c' alias ip='ip -c'
fi fi
# because `libreWolf` is ambiguous for tab completion # because `libreWolf` is ambiguous for tab completion
if $(which librewolf &>/dev/null); then if $(command -v librewolf &>/dev/null); then
alias firefox='librewolf' alias firefox='librewolf'
elif $(which librewolf.appimage &>/dev/null); then elif $(command -v librewolf.appimage &>/dev/null); then
alias firefox='librewolf.appimage' alias firefox='librewolf.appimage'
fi fi
@@ -71,7 +71,7 @@ fi
## run script to setup default tmux session and then attach the session ## run script to setup default tmux session and then attach the session
## attaching the session needs to be done from the calling shell, otherwise ## attaching the session needs to be done from the calling shell, otherwise
## the setup script will only terminate after detaching or killing the session ## the setup script will only terminate after detaching or killing the session
if $(which tmux &>/dev/null); then if $(command -v tmux &>/dev/null); then
alias dmux='bash default-tmux-session.sh && tmux attach' alias dmux='bash default-tmux-session.sh && tmux attach'
alias tks='tmux kill-session' alias tks='tmux kill-session'
@@ -91,7 +91,7 @@ PS1='[\u@\h \W]\$ '
export TERM="xterm-256color" export TERM="xterm-256color"
# setup `starship` # setup `starship`
if $(which starship &>/dev/null); then if $(command -v starship &>/dev/null); then
eval "$(starship init bash)" eval "$(starship init bash)"
fi fi