fix(install.sh):fix arr out of bounds

This commit is contained in:
likzn 2022-05-04 00:46:49 +08:00
parent b759ef6b58
commit 7027320a8f

View File

@ -75,6 +75,21 @@ function vercomp() {
then then
max_len=$len2 max_len=$len2
fi fi
#pad right in short arr
if [[ len1 -gt len2 ]];
then
for ((i = len2; i < len1; i++));
do
v2[$i]=0
done
else
for ((i = len1; i < len2; i++));
do
v1[$i]=0
done
fi
for i in `seq 0 $max_len` for i in `seq 0 $max_len`
do do
# Fill empty fields with zeros in v1 # Fill empty fields with zeros in v1