Closed carlosmmatos closed 1 year ago
I wonder if sort -V
or something like https://apple.stackexchange.com/questions/83939/compare-multi-digit-version-numbers-in-bash/123408#123408 would be better.
Approved before I saw gabes comment. Changes LGTM, but I'll let you two decide what to do with that :)
I wonder if
sort -V
or something like https://apple.stackexchange.com/questions/83939/compare-multi-digit-version-numbers-in-bash/123408#123408 would be better.
I went through a few different iterations.. each time stumbling upon the misery of supporting bash and dash lol... what I have here is easily readable and works for both.
The sort -V is an interesting approach - however I'm not sure how readable it is or if -V and -C options are supported on all versions lol..
@redhatrises This is what sort -V -C approach would look like:
old_curl=$(
version=$(curl --version | head -n 1 | awk '{ print $2 }')
minimum="7.55"
# Check if the version is less than the minimum
if echo -e "$version\n$minimum" | sort -V -C; then
echo 0
else
echo 1
fi
)
Other than the comment.. I wouldn't know wth is going on lol. What do you think?
@redhatrises code has been updated to work with sort
as well as bash/dash
Fixes #174
This PR enhances the logic used to test for curl version compatability.