i wrote the following script. It will be used in a build process later. My goal is to decide whether it's a pre release or a release. To archive this i compare $release to a RegEx. If my RegEx matches it's a pre release, if not it's a release.
#/bin/bash
release="1.9.2-alpha1"
echo "$release"
if [[ "$release" =~ \d+\.\d+\.\d+[-]+.* ]];then
echo "Pre"
else
echo "Release"
fi
But as result i always end up with the following:
~$ bash releasescript.sh
1.9.2-alpha1
Release
Version:
Ubuntu 18.04.1 LTS
I used this editor to test my RegEx. I'm stuck for at least 6h, so i would appreciate some help greatly.