From 456fcb4478a45b422fb898e54e12120e3cf388f9 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Wed, 15 Dec 2021 11:31:12 +0100 Subject: [PATCH] Refactoring: Always use "[[" (instead of "[") No functional changes. --- core/40_path/40_path.zprofile | 6 +++--- plugins/browser_select/browser_select.zprofile | 2 +- plugins/editor_select/editor_select.zprofile | 2 +- plugins/iterm2/iterm2.zshrc | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/40_path/40_path.zprofile b/core/40_path/40_path.zprofile index 0ee2a17..0349029 100644 --- a/core/40_path/40_path.zprofile +++ b/core/40_path/40_path.zprofile @@ -30,7 +30,7 @@ for d ( ~/sbin ~/Applications ); do - [ -d "$d" ] && path=("$d" $path) + [[ -d "$d" ]] && path=("$d" $path) done # Append additional search paths @@ -39,7 +39,7 @@ for d ( /usr/local/games /usr/games ); do - [ -d "$d" ] && path=($path "$d") + [[ -d "$d" ]] && path=($path "$d") done # Set default MANPATH @@ -55,7 +55,7 @@ if [[ $? -ne 0 ]]; then /usr/share/man /usr/local/share/man ); do - [ -d "$d" ] && manpath=($manpath "$d") + [[ -d "$d" ]] && manpath=($manpath "$d") done fi typeset -Ux MANPATH diff --git a/plugins/browser_select/browser_select.zprofile b/plugins/browser_select/browser_select.zprofile index 0f72e74..bdda278 100644 --- a/plugins/browser_select/browser_select.zprofile +++ b/plugins/browser_select/browser_select.zprofile @@ -18,7 +18,7 @@ if [[ -z "$BROWSER" ]]; then $x11_browsers elinks w3m links2 links lynx ); do - if [ -n "$commands[$browser]" ]; then + if [[ -n "$commands[$browser]" ]]; then BROWSER="$commands[$browser]" break fi diff --git a/plugins/editor_select/editor_select.zprofile b/plugins/editor_select/editor_select.zprofile index 3aecb6f..1fdc1c9 100644 --- a/plugins/editor_select/editor_select.zprofile +++ b/plugins/editor_select/editor_select.zprofile @@ -12,7 +12,7 @@ if [[ -z "$EDITOR" ]]; then $x11_editors vim nano joe vi ); do - if [ -n "$commands[$editor]" ]; then + if [[ -n "$commands[$editor]" ]]; then EDITOR="$commands[$editor]" break fi diff --git a/plugins/iterm2/iterm2.zshrc b/plugins/iterm2/iterm2.zshrc index 0886e49..211e617 100644 --- a/plugins/iterm2/iterm2.zshrc +++ b/plugins/iterm2/iterm2.zshrc @@ -137,14 +137,14 @@ iterm2_decorate_prompt() { iterm2_precmd() { local STATUS="$?" - if [ -z "${ITERM2_SHOULD_DECORATE_PROMPT-}" ]; then + if [[ -z "${ITERM2_SHOULD_DECORATE_PROMPT-}" ]]; then # You pressed ^C while entering a command (iterm2_preexec did not run) iterm2_before_cmd_executes fi iterm2_after_cmd_executes "$STATUS" - if [ -n "$ITERM2_SHOULD_DECORATE_PROMPT" ]; then + if [[ -n "$ITERM2_SHOULD_DECORATE_PROMPT" ]]; then iterm2_decorate_prompt fi } -- 2.39.2