Closed TonyLHansen closed 1 year ago
This line
py_main_version=${new_version::-2}
does not handle versions such as 3.9.10 - 3.9.13.
You would be better off using the venerable sed, as in:
py_main_version=$(echo "$new_version" | sed 's/[.][^.]*$//')
One more tweak to the sed line allows you to specify a version such as 3.9 (with no subversion):
py_main_version=$(echo "$new_version" | sed '/[.].*[.].*/s/[.][^.]*$//')
You might also consider doing apt install shellcheck; shellcheck python.sh and fixing the items pointed out by that tool.
apt install shellcheck; shellcheck python.sh
Thank you @TonyLHansen I'll look into this!
This line
does not handle versions such as 3.9.10 - 3.9.13.
You would be better off using the venerable sed, as in:
One more tweak to the sed line allows you to specify a version such as 3.9 (with no subversion):
You might also consider doing
apt install shellcheck; shellcheck python.sh
and fixing the items pointed out by that tool.