From 0d9cadbc15506301ff3733364832b9bbe33876ea Mon Sep 17 00:00:00 2001 From: Guilherme Amadio Date: Sun, 1 Sep 2024 18:43:41 +0200 Subject: [PATCH] Fix shellcheck issues in genversion.sh and gen-tarball.sh --- gen-tarball.sh | 4 ++-- genversion.sh | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gen-tarball.sh b/gen-tarball.sh index cb05ec7c2ac..22d84bcf53d 100755 --- a/gen-tarball.sh +++ b/gen-tarball.sh @@ -2,10 +2,10 @@ set -e -TAG=$(printf "%s" "$(git describe "${1:-HEAD}")") +TAG="$(printf "%s" "$(git describe "${1:-HEAD}")")" NAME="xrootd-${TAG#v}" set -x -git archive -9 --prefix="${NAME}/" -o "${NAME}.tar.gz" ${TAG} +git archive -9 --prefix="${NAME}/" -o "${NAME}.tar.gz" "${TAG}" diff --git a/genversion.sh b/genversion.sh index 1b465e9a1ad..66df1fca155 100755 --- a/genversion.sh +++ b/genversion.sh @@ -12,7 +12,7 @@ function usage() { cat 1>&2 <<-EOF Usage: - $(basename $0) [--help|--version] + $(basename "$0") [--help|--version] --help prints this message --print-only ignored, used for backward compatibility @@ -21,15 +21,15 @@ function usage() EOF } -SRC=$(dirname $0) -VF=${SRC}/VERSION +SRC="$(dirname "$0")" +VF="${SRC}/VERSION" if [[ -n "${XRDVERSION}" ]]; then - VERSION=${XRDVERSION}; + VERSION="${XRDVERSION}"; elif [[ -r "${VF}" ]] && grep -vq "Format:" "${VF}"; then - VERSION=$(sed -e 's/-g/+git/' "${VF}") -elif git -C ${SRC} describe --match 'v*' >/dev/null 2>&1; then - VERSION=$(git -C ${SRC} describe --match 'v*' | sed -e 's/-g/+git/') + VERSION="$(sed -e 's/-g/+git/' "${VF}")" +elif git -C "${SRC}" describe --match 'v*' >/dev/null 2>&1; then + VERSION="$(git -C "${SRC}" describe --match 'v*' | sed -e 's/-g/+git/')" else VERSION="v5.7-rc$(date +%Y%m%d)" fi @@ -67,7 +67,7 @@ while [[ $# -gt 0 ]]; do done if [[ -v SANITIZE ]]; then - VERSION=$(sed -e 's/v//; s/-rc/~rc/; s/-g/+git/; s/-/.post/; s/-/./' <<< ${VERSION}) + VERSION=$(sed -e 's/v//; s/-rc/~rc/; s/-g/+git/; s/-/.post/; s/-/./' <<< "${VERSION}") fi printf "%s" "${VERSION}"