From db3c8930872645e9874cbefc9a49e35dafc52586 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Fri, 5 Jan 2024 15:03:31 -0800 Subject: [PATCH] fix: Quote path variables and avoid `-o`/`-a` flags to `[` --- config/helpers.sh | 4 ++-- lib/arg_processing.sh | 2 +- lib/muting.sh | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/helpers.sh b/config/helpers.sh index caba053b..555b28b9 100644 --- a/config/helpers.sh +++ b/config/helpers.sh @@ -1,9 +1,9 @@ # Other settings and helper functions. debug_mode_enabled() { - [ -n "$TMUX_POWERLINE_DEBUG_MODE_ENABLED" -a "$TMUX_POWERLINE_DEBUG_MODE_ENABLED" != "false" ]; + [ -n "$TMUX_POWERLINE_DEBUG_MODE_ENABLED" ] && [ "$TMUX_POWERLINE_DEBUG_MODE_ENABLED" != "false" ]; } patched_font_in_use() { - [ -z "$TMUX_POWERLINE_PATCHED_FONT_IN_USE" -o "$TMUX_POWERLINE_PATCHED_FONT_IN_USE" != "false" ]; + [ -z "$TMUX_POWERLINE_PATCHED_FONT_IN_USE" ] || [ "$TMUX_POWERLINE_PATCHED_FONT_IN_USE" != "false" ]; } diff --git a/lib/arg_processing.sh b/lib/arg_processing.sh index e2f96ae9..d6ca9c05 100644 --- a/lib/arg_processing.sh +++ b/lib/arg_processing.sh @@ -2,7 +2,7 @@ check_arg_side() { local side="$1" - if ! [ "$side" == "left" -o "$side" == "right" -o "$side" == "init" ]; then + if ! [[ "$side" == "left" || "$side" == "right" || "$side" == "init" ]]; then echo "Argument must be the side to handle {left, right} or {init} and not \"${side}\"." exit 1 fi diff --git a/lib/muting.sh b/lib/muting.sh index 595ba874..66738908 100644 --- a/lib/muting.sh +++ b/lib/muting.sh @@ -2,14 +2,14 @@ # In all cases $1 is the side to be muted (eg left/right). powerline_muted() { - [ -e "$(__powerline_mute_file $1)" ]; + [ -e "$(__powerline_mute_file "$1")" ]; } toggle_powerline_mute_status() { - if powerline_muted $1; then - rm "$(__powerline_mute_file $1)" + if powerline_muted "$1"; then + rm "$(__powerline_mute_file "$1")" else - touch "$(__powerline_mute_file $1)" + touch "$(__powerline_mute_file "$1")" fi }