From 7f47ebbd2726b447d301ec1752a3de0034f72157 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 30 Jun 2023 14:00:19 +0200 Subject: [PATCH] axify: Fix some more shellcheck(1) warnings Apply the proper fix for "SC2292 Prefer [[ ]] over [ ] for tests in Bash/Ksh", but disable "SC2250 Prefer putting braces around variable references even when not strictly required". --- scripts/axify | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/axify b/scripts/axify index 2cd3be2..a9ec269 100755 --- a/scripts/axify +++ b/scripts/axify @@ -1,7 +1,8 @@ #!/bin/bash +# shellcheck disable=SC2250 # # ax-make: Alex' Simple Makefile System -# Copyright (c)2014-2022 Alexander Barton (alex@barton.de) +# Copyright (c)2014-2023 Alexander Barton (alex@barton.de) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -82,13 +83,13 @@ while true; do shift done -[ $# -gt 1 ] && Usage +[[ $# -gt 1 ]] && Usage -[ -n "$1" ] && LIB_D="$1" +[[ -n "$1" ]] && LIB_D="$1" -if [ -r "/usr/local/share/ax-make/Makefile.ax" ]; then +if [[ -r "/usr/local/share/ax-make/Makefile.ax" ]]; then MAKEFILE_AX="/usr/local/share/ax-make/Makefile.ax" -elif [ -r "/usr/share/ax-make/Makefile.ax" ]; then +elif [[ -r "/usr/share/ax-make/Makefile.ax" ]]; then MAKEFILE_AX="/usr/share/ax-make/Makefile.ax" else echo "$NAME: No source \"Makefile.ax\" found!" @@ -98,12 +99,12 @@ fi # -- Makefile.ax -- -if [ ! -d "$LIB_D" ]; then +if [[ ! -d "$LIB_D" ]]; then mkdir -pv "$LIB_D" || exit 1 fi target="$LIB_D/$(basename "$MAKEFILE_AX")" -if [ ! -e "$target" ] || [ "$MAKEFILE_AX" -nt "$target" ]; then +if [[ ! -e "$target" || "$MAKEFILE_AX" -nt "$target" ]]; then echo "Updating \"$target\" ..." cp -v "$MAKEFILE_AX" "$target" || exit 1 else @@ -112,9 +113,9 @@ fi # -- Project Makefile's --- -if [ ! -e "Makefile" ]; then +if [[ ! -e "Makefile" ]]; then echo "Creating \"Makefile\" ..." -[ "$LIB_D" != "." ] && subdirs="$LIB_D" || subdirs="" +[[ "$LIB_D" != "." ]] && subdirs="$LIB_D" || subdirs="" cat >"Makefile" <"$LIB_D/Makefile" <