From adf2e0caec46fa82eea3ae4754fd0bea8d137e3d Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sun, 5 Mar 2023 17:26:21 +0100 Subject: [PATCH] fixed shellcheck SC2015 violation SC2015 (info): Note that A && B || C is not if-then-else. C may run when A is true --- .tmux.conf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 12e0ee9..3646eb7 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -358,7 +358,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # done # ;; # esac -# [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') || true +# if [ "$count" -ne 0 ]; then +# charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }') +# fi # } # # _battery_status() { @@ -869,8 +871,10 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # # # ignore bindings with errors # if ! tmux source-file "$cfg.in"; then -# verbose_flag=$(tmux source-file -v /dev/null 2> /dev/null && printf -- '-v' || true) -# while ! out=$(tmux source-file "$verbose_flag" "$cfg.in"); do +# if tmux source-file -v /dev/null 2> /dev/null; then +# verbose_flag='-v' +# fi +# while ! out=$(tmux source-file "${verbose_flag:+$verbose_flag}" "$cfg.in"); do # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) # perl -n -i -e "if ($. != $line) { print }" "$cfg.in" # done @@ -1504,8 +1508,10 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration' # # if perl -n -e 'print if /^\s*(?:set|bind|unbind).+?#!important\s*$/' "$TMUX_CONF_LOCAL" 2>/dev/null > "$cfg.local"; then # if ! tmux source-file "$cfg.local"; then -# verbose_flag=$(tmux source-file -v /dev/null 2> /dev/null && printf -- '-v' || true) -# while ! out=$(tmux source-file "$verbose_flag" "$cfg.local"); do +# if tmux source-file -v /dev/null 2> /dev/null; then +# verbose_flag='-v' +# fi +# while ! out=$(tmux source-file "${verbose_flag:+$verbose_flag}" "$cfg.local"); do # line=$(printf "%s" "$out" | tail -1 | cut -d':' -f2) # perl -n -i -e "if ($. != $line) { print }" "$cfg.local" # done