From: Ben Crocker <bcrocker@xxxxxxxxxx> SC2007: Use $((..)) instead of deprecated $[..] SC2086: Double quote to prevent globbing and word splitting. SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. EVEN BETTER: use [[ p || q ]]. Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx> --- redhat/scripts/new_release.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/redhat/scripts/new_release.sh b/redhat/scripts/new_release.sh index 1e4c7bb1dc86..9d1426b9ce6a 100755 --- a/redhat/scripts/new_release.sh +++ b/redhat/scripts/new_release.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ -z "$1" -o -z "$2" ]; then - echo "$(basename $0) <redhat path> <zstream? no/yes/branch>" >&2; +if [[ -z $1 || -z $2 ]]; then + echo "$(basename "$0") <redhat path> <zstream? no/yes/branch>" >&2; exit 1; fi @@ -13,28 +13,28 @@ if [ -s "$RHPATH/linux-kernel-test.patch" ]; then exit 1; fi -RELEASE=$(sed -n -e 's/^RHEL_RELEASE\ =\ \(.*\)/\1/p' $RHPATH/../Makefile.rhelver) +RELEASE=$(sed -n -e 's/^RHEL_RELEASE\ =\ \(.*\)/\1/p' "$RHPATH"/../Makefile.rhelver) -YVER=$(echo $RELEASE | cut -d "." -f 1) -YVER=${YVER:=$RELEASE} -ZMAJ=$(echo $RELEASE | cut -s -d "." -f 2) +YVER=$(echo "$RELEASE" | cut -d "." -f 1) +YVER=${YVER:="$RELEASE"} +ZMAJ=$(echo "$RELEASE" | cut -s -d "." -f 2) ZMAJ=${ZMAJ:=0} -ZMIN=$(echo $RELEASE | cut -s -d "." -f 3) +ZMIN=$(echo "$RELEASE" | cut -s -d "." -f 3) ZMIN=${ZMIN:=0} if [ "$ZSTREAM_FLAG" == "no" ]; then if [ "$YSTREAM_FLAG" == "yes" ]; then - NEW_RELEASE="$[RELEASE + 1]"; + NEW_RELEASE="$((RELEASE + 1))"; else - EARLY_YBUILD=$(sed -n -e 's/^EARLY_YBUILD:=\(.*\)/\1/p' $RHPATH/../Makefile.rhelver); - EARLY_YRELEASE=$(sed -n -e 's/^EARLY_YRELEASE:=\(.*\)/\1/p' $RHPATH/../Makefile.rhelver); + EARLY_YBUILD=$(sed -n -e 's/^EARLY_YBUILD:=\(.*\)/\1/p' "$RHPATH"/../Makefile.rhelver); + EARLY_YRELEASE=$(sed -n -e 's/^EARLY_YRELEASE:=\(.*\)/\1/p' "$RHPATH"/../Makefile.rhelver); if [ "$EARLY_YBUILD" != "$RELEASE" ]; then NEW_EARLY_YRELEASE=1; else - NEW_EARLY_YRELEASE="$[EARLY_YRELEASE + 1]"; + NEW_EARLY_YRELEASE="$((EARLY_YRELEASE + 1))"; fi - sed -i -e "s/^EARLY_YBUILD:=$EARLY_YBUILD/EARLY_YBUILD:=$RELEASE/" $RHPATH/../Makefile.rhelver; - sed -i -e "s/^EARLY_YRELEASE:=$EARLY_YRELEASE/EARLY_YRELEASE:=$NEW_EARLY_YRELEASE/" $RHPATH/../Makefile.rhelver; + sed -i -e "s/^EARLY_YBUILD:=$EARLY_YBUILD/EARLY_YBUILD:=$RELEASE/" "$RHPATH"/../Makefile.rhelver; + sed -i -e "s/^EARLY_YRELEASE:=$EARLY_YRELEASE/EARLY_YRELEASE:=$NEW_EARLY_YRELEASE/" "$RHPATH"/../Makefile.rhelver; NEW_RELEASE=$RELEASE; fi elif [ "$ZSTREAM_FLAG" == "yes" ]; then @@ -42,9 +42,9 @@ elif [ "$ZSTREAM_FLAG" == "yes" ]; then elif [ "$ZSTREAM_FLAG" == "branch" ]; then NEW_RELEASE=$YVER.$ZMAJ.$((ZMIN+1)); else - echo "$(basename $0) invalid <zstream> value, allowed [no|yes|branch]" >&2; + echo "$(basename "$0") invalid <zstream> value, allowed [no|yes|branch]" >&2; exit 1; fi -sed -i -e "s/RHEL_RELEASE\ =.*/RHEL_RELEASE\ =\ $NEW_RELEASE/" $RHPATH/../Makefile.rhelver; +sed -i -e "s/RHEL_RELEASE\ =.*/RHEL_RELEASE\ =\ $NEW_RELEASE/" "$RHPATH"/../Makefile.rhelver; -- GitLab _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx