fix: declare -i [SC2324 shellcheck] (#2624)

Fix SC2324 shellcheck warning by adding -i to indicate var type of
integer and tidy up the formatting.
This commit is contained in:
Klaijan 2024-03-08 17:09:55 +07:00 committed by GitHub
parent b27ad9b6aa
commit 30b6a09bc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,12 +16,12 @@ function usage {
}
function getopts-extra() {
declare i=1
declare -i i=1
# if the next argument is not an option, then append it to array OPTARG
while [[ ${OPTIND} -le $# && ${!OPTIND:0:1} != '-' ]]; do
OPTARG[i]=${!OPTIND}
i+=1
OPTIND+=1
((i += 1))
((OPTIND += 1))
done
}