Skip to content

Commit

Permalink
Replaced regexp evaluatuin with grep
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Mar 30, 2023
1 parent 69a63c4 commit 6d56608
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ validate_input() {
exit 1
fi

if [ "$version" != "latest" ] && [[ ! "$version" =~ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then
report "Invalid version: $version"
exit 1
if [ "$version" != "latest" ]; then
# Remove leading 'v' if present
version="${version#v}"

# Check if version is valid using grep
if ! echo "$version" | grep -qE "^[0-9]+\.[0-9]+\.[0-9]+$"; then
report "Invalid version: $version"
exit 1
fi
fi
}

Expand Down

0 comments on commit 6d56608

Please sign in to comment.