style(shell): improve shell script formatting and quoting

Apply shfmt formatting and fix some schellcheck complaints.
This commit is contained in:
2025-11-25 02:52:36 +00:00
parent 9941b28063
commit adb008b301
17 changed files with 66 additions and 65 deletions

View File

@@ -19,16 +19,16 @@ fi
# The vercomp() function is shamelessly ripped/borrowed from the following
# StackOverflow answer: http://stackoverflow.com/a/4025065/42146
vercomp () {
vercomp() {
if [[ $1 == $2 ]]; then return 0; fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do ver1[i]=0; done
for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)); do ver1[i]=0; done
for ((i=0; i<${#ver1[@]}; i++)); do
for ((i = 0; i < ${#ver1[@]}; i++)); do
# fill empty fields in ver2 with zeros
if [[ -z ${ver2[i]} ]]; then ver2[i]=0; fi
@@ -63,8 +63,8 @@ else
vercomp "$version" "$1"
case $? in
0) echo '=';;
1) echo '>';;
2) echo '<';;
0) echo '=' ;;
1) echo '>' ;;
2) echo '<' ;;
esac
fi