I am working on custom bash script which would run bunch of command that would result on updating on updating a web application.
So I'd have a list of versions (short snipped of my bash code):
declare -a Versions=("1.3.17" "1.3.18" "1.3.19" "1.3.20" "1.4.0-beta.1" "1.4.0-beta.1" "1.4.0-beta.2" "1.4.0" "1.4.1" "1.4.2" "1.4.3" "1.4.4" "1.5.0-beta.1" "1.5.0" "1.5.1" "1.5.2")
echo "Please enter current version"
read version
echo "Please enter version which you'd like to upgrade"
read updateVersion
case "$updateVersion" in
1.5.2)
for val in "${Versions[@]}"; do
# Not sure how to treat version comparison. Basically the version would be added in order on the $Versions array. Higher index in array would mean higher version to upgrade.
if [ "$val" == "$updateVersion" ]; then
echo "Update to version from $updateVersion to $val"
else
# Not sure if this is really needed
echo ""
fi
echo $val
done
echo "Updating HumHub from $version to $updateVersion"
;;
*)
echo $"Usage: $0 {1.3.17|1.3.18|1.3.19|1.3.20|1.4.0-beta.1|1.4.0-beta.1|1.4.0-beta.2|1.4.0|1.4.1|1.4.2|1.4.3|1.4.4|1.5.0-beta.1|1.5.0|1.5.1|1.5.2}"
exit 1
esac
How do I allow so that only the upgrade would take place if I'd specify: $version=1.3.17
and $version=1.5.2
?