From 4490ce41071dee602d52a4ba0c2cd5804d405613 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 16 Feb 2023 05:02:22 +0800 Subject: [PATCH] refactor(tools): fix shell check issues --- tools/init | 7 ++++--- tools/release | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/init b/tools/init index 1848f9b..5ea1da0 100755 --- a/tools/init +++ b/tools/init @@ -21,7 +21,7 @@ help() { check_status() { if [[ -n $(git status . -s) ]]; then echo "Error: Commit unstaged files first, and then run this tool again." - exit -1 + exit 1 fi } @@ -33,7 +33,8 @@ check_init() { else if [[ -f .github/workflows/$ACTIONS_WORKFLOW ]]; then # on BSD, the `wc` could contains blank - local _count="$(find .github/workflows/ -type f -name "*.yml" | wc -l)" + local _count + _count=$(find .github/workflows/ -type f -name "*.yml" | wc -l) if [[ ${_count//[[:blank:]]/} == 1 ]]; then _has_inited=true fi @@ -47,7 +48,7 @@ check_init() { } checkout_latest_tag() { - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + tag=$(git describe --tags "$(git rev-list --tags --max-count=1)") git reset --hard "$tag" } diff --git a/tools/release b/tools/release index b9cdfbc..f6bc6d0 100755 --- a/tools/release +++ b/tools/release @@ -104,7 +104,7 @@ check() { _bump_file() { for i in "${!FILES[@]}"; do - if [[ ${FILES[$i]} == $NODE_CONFIG ]]; then + if [[ ${FILES[$i]} == "$NODE_CONFIG" ]]; then continue fi