tvdsluijs / sh-python-installer

General easy to use Raspberry Pi & Ubuntu Python installer
MIT License
70 stars 19 forks source link

does not handle any subversions >=10 #8

Closed TonyLHansen closed 1 year ago

TonyLHansen commented 2 years 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.

tvdsluijs commented 2 years ago

Thank you @TonyLHansen I'll look into this!