My Bash script accepts an argument of a version number, in the following format: #.#.#.#.dev or #.#.#.#.prod, where # can be any number, for example: 3.6.212.0.dev.
I want to verify that the argument is in the right format (contains all the 4 numbers separated by dots and includes .prod or .dev in the end).
I'm not sure how to achieve this, so far I've tried this:
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "error: Incorrect version specified; must be in the format of #.#.#.#.env" >&2; exit 1
fi