From c572b2cb109ad4dcb242b2f0bec32d36373f36c4 Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 22 Apr 2024 09:47:24 +0200 Subject: [PATCH] zsh: fix command lookup using $+array[] syntax --- brethil_dotfile.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/brethil_dotfile.sh b/brethil_dotfile.sh index 72127f3..a1f3be0 100755 --- a/brethil_dotfile.sh +++ b/brethil_dotfile.sh @@ -39,12 +39,12 @@ if [[ ! ${zsh_plugins}.zsh -nt ${zsh_plugins}.txt ]]; then antidote bundle <${zsh_plugins}.txt >>${zsh_plugins}.zsh - if [[ $+commands[systemctl] ]]; then + if (( $+commands[systemctl] )); then antidote bundle robbyrussell/oh-my-zsh path:plugins/systemd >>${zsh_plugins}.zsh fi - if [[ $+commands[pacman] ]]; then + if (( $+commands[pacman] )); then antidote bundle robbyrussell/oh-my-zsh path:plugins/archlinux >>${zsh_plugins}.zsh - elif [[ $+commands[apt-get] ]]; then + elif (( $+commands[apt-get] )); then antidote bundle robbyrussell/oh-my-zsh path:plugins/debian >>${zsh_plugins}.zsh fi @@ -60,7 +60,7 @@ source $DOTFILES/extras/completion_style.zsh source $DOTFILES/extras/colors.zsh source $DOTFILES/extras/fzf-tab-config.zsh -if [[ $+commands[fd] ]]; then +if (( $+commands[fd] )); then export FZF_CTRL_T_COMMAND='fd' else export FZF_CTRL_T_COMMAND='find' @@ -112,8 +112,8 @@ export ZSH_AUTOSUGGEST_COMPLETION_IGNORE='* \#*' # prevent completion for commen # less options export LESS='-xRF-j12' # -j12: displays 12 lines before search results with / and ? -if [[ $+commands[bat] || $+commands[batcat] ]]; then - if [[ $+commands[bat] ]]; then cmd=bat else cmd=batcat fi +if (( $+commands[bat] || $+commands[batcat] )); then + if (( $+commands[bat] )); then cmd=bat else cmd=batcat fi alias cat=$cmd export PAGER=$cmd