gnuboot-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 09/18] website-build: build.sh: make it pass shellcheck.


From: Denis 'GNUtoo' Carikli
Subject: [PATCH v1 09/18] website-build: build.sh: make it pass shellcheck.
Date: Sat, 25 May 2024 20:25:44 +0200

Without that fix, shellcheck -x complains a lot:
    In build.sh line 53:
    mkdir -p "$(dirname ${dst_path})"
                        ^---------^
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 82:
    git -C "${dst_path}" am $(realpath ${patch})
                            ^------------------^
    SC2046 (warning): Quote this to prevent word splitting.
    git -C "${dst_path}" am $(realpath ${patch})
                                       ^------^
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 112:
    opt="$(eval echo \$$i)"
                       ^--
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 127:
    untitled_path="$(eval echo \$$(expr $i + 1))"
                                 ^------------^
    SC2046 (warning): Quote this to prevent word splitting.
    untitled_path="$(eval echo \$$(expr $i + 1))"
                                   ^--^
    SC2003 (style): expr is antiquated.
    Consider rewriting this using $((..)), ${} or [[ ]].
    untitled_path="$(eval echo \$$(expr $i + 1))"
                                        ^--
    SC2086 (info): Double quote to prevent globbing and word splitting.

    In build.sh line 128:
    i="$(expr "$i" + 1)"
         ^--^
    SC2003 (style): expr is antiquated.
    Consider rewriting this using $((..)), ${} or [[ ]].

    In build.sh line 136:
    i="$(expr "$i" + 1)"
         ^--^
    SC2003 (style): expr is antiquated.
    Consider rewriting this using $((..)), ${} or [[ ]].

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
---
 tests/lint             |  1 +
 website-build/build.sh | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/lint b/tests/lint
index ce9d405..d00bfc4 100755
--- a/tests/lint
+++ b/tests/lint
@@ -66,6 +66,7 @@ run_shellcheck \
     resources/scripts/tasks/distclean.sh \
     tests/distclean \
     tests/lint \
+    website-build/build.sh \
     website-build/check.sh
 
 printf "+---------------------+\n"
diff --git a/website-build/build.sh b/website-build/build.sh
index 1dc16ee..77e332b 100755
--- a/website-build/build.sh
+++ b/website-build/build.sh
@@ -50,7 +50,7 @@ sync_repo()
                git clone "${src_uri}" "${dst_path}"
                git -C "${dst_path}" checkout "${src_revision}"
        elif [ ! -d "${dst_path}" ] ; then
-               mkdir -p "$(dirname ${dst_path})"
+               mkdir -p "$(dirname "${dst_path}")"
                cp -a "${src_path}" "${dst_path}"
                if [ -n "${src_revision}" ] ; then
                        git -C "${dst_path}" checkout "${src_revision}"
@@ -79,7 +79,7 @@ sync_repo()
                for patch in ${src_patches} ; do
                        GIT_COMMITTER_EMAIL="noreply@gnuboot.gnu.org" \
                        GIT_COMMITTER_NAME="website-build" \
-                       git -C "${dst_path}" am $(realpath ${patch})
+                       git -C "${dst_path}" am "$(realpath "${patch}")"
                done
        else
                rm -rf "${dst_path}"
@@ -124,8 +124,8 @@ while [ "$i" -le $# ] ; do
                                help_missing_arg "--with-untitled-path"
                                exit ${EX_USAGE}
                        fi
-                       untitled_path="$(eval echo \$$(expr $i + 1))"
-                       i="$(expr "$i" + 1)"
+                       untitled_path="$(eval echo \$$((i + 1)))"
+                       i="$((i + 1))"
                        ;;
                *)
                        help
@@ -133,7 +133,7 @@ while [ "$i" -le $# ] ; do
                        ;;
        esac
 
-       i="$(expr "$i" + 1)"
+       i="$((i + 1))"
 done
 
 set -e
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]