diff options
author | wileyhy <84648683+wileyhy@users.noreply.github.com> | 2023-04-28 19:49:48 -0700 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2023-05-03 16:29:52 +0200 |
commit | 4588b2f8aebb00f94ecd9b6029ddb0de82fd6d94 (patch) | |
tree | 37fade5c5574164c1d750608bea0991620a73302 | |
parent | 42bba8ac6113710317cf19bafd5da246f72056bf (diff) | |
download | alsa-utils-4588b2f8aebb00f94ecd9b6029ddb0de82fd6d94.tar.gz |
alsa-info.sh: Update `test` '-a' and '-o' to '&&' and '||'
lines 50, 103: in two compound ['s, replace '-a' with '] && ['
SC2166 – Prefer `[ p ] && [ q ]` as `[ p -a q ]` is not well defined.
SC2107 – Instead of `[ a && b ]`, use `[ a ] && [ b ]`.
line 45: in a compound test command, change '-o' to '|| test'
SC1139 – Use `||` instead of `-o` between test commands.
SC2109 – Instead of `[ a || b ]`, use `[ a ] || [ b ]`.
... https://github.com/koalaman/shellcheck
Fixes: https://github.com/alsa-project/alsa-utils/pull/206
From: wileyhy @ github
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rwxr-xr-x | alsa-info/alsa-info.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index 04d6d17..4934d70 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -42,12 +42,12 @@ REQUIRES="mktemp grep pgrep awk date uname cat sort dmesg amixer alsactl" # update() { - test -z "$WGET" -o ! -x "$WGET" && return + test -z "$WGET" || test ! -x "$WGET" && return SHFILE=$(mktemp -t alsa-info.XXXXXXXXXX) || exit 1 wget -O $SHFILE "https://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1 REMOTE_VERSION=$(grep SCRIPT_VERSION $SHFILE | head -n1 | sed 's/.*=//') - if [ -s "$SHFILE" -a "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then + if [ -s "$SHFILE" ] && [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then if [[ -n $DIALOG ]] then OVERWRITE= @@ -100,7 +100,7 @@ update() { } cleanup() { - if [ -n "$TEMPDIR" -a "$KEEP_FILES" != "yes" ]; then + if [ -n "$TEMPDIR" ] && [ "$KEEP_FILES" != "yes" ]; then rm -rf "$TEMPDIR" 2>/dev/null fi test -n "$KEEP_OUTPUT" || rm -f "$NFILE" |