(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
export PAGER='less --use-color -R'
if $(which nvim &>/dev/null); then
if $(command -v nvim &>/dev/null); then
export MANPAGER='nvim +Man!'
alias vim='nvim'
fi
@@ -31,13 +31,13 @@ fi
#bind -r "\C-l"
# define aliases
if ! $(which navigate &>/dev/null); then
if ! $(command -v navigate &>/dev/null); then
alias push='pushd'
alias pop='popd'
alias stack='dirs -v'
fi
if $(which eza &>/dev/null); then
if $(command -v eza &>/dev/null); then
alias list='eza -lao --no-permissions --group-directories-first \
-s=ext --color=always --time-style long-iso'
alias tree='eza -laoT --no-permissions --group-directories-first \
@@ -47,7 +47,7 @@ else
fi
# aliases related to `grep`
if $(which ug &>/dev/null); then
if $(command -v ug &>/dev/null); then
alias ugi='ug -j'
fi
alias grep='grep --color=always'
@@ -56,14 +56,14 @@ alias bdiff='diff -uw --color=always'
alias sbash='source ~/.bashrc'
if $(which ip &>/dev/null); then
if $(command -v ip &>/dev/null); then
alias ip='ip -c'
fi
# because `libreWolf` is ambiguous for tab completion
if $(which librewolf &>/dev/null); then
if $(command -v librewolf &>/dev/null); then
alias firefox='librewolf'
elif $(which librewolf.appimage &>/dev/null); then
elif $(command -v librewolf.appimage &>/dev/null); then
alias firefox='librewolf.appimage'
fi
@@ -71,7 +71,7 @@ fi
## run script to setup default tmux session and then attach the session
## attaching the session needs to be done from the calling shell, otherwise
## 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 tks='tmux kill-session'
@@ -91,7 +91,7 @@ PS1='[\u@\h \W]\$ '
export TERM="xterm-256color"
# setup `starship`
if $(which starship &>/dev/null); then
if $(command -v starship &>/dev/null); then
eval "$(starship init bash)"
fi