#!/bin/bash # Git repository REPO="https://sourceware.org/git/glibc.git" # Get tag name using 'git ls-remote' TAG_NAME=$(git ls-remote --exit-code --refs --tags --sort='v:refname' "$REPO" | cut -d'/' -f3 | grep -w -E "glibc-([0-9]*\.[0-9]*)\$" | tail -n1) # Trim 'glibc-' prefix from TAG_NAME VERSION="${TAG_NAME//glibc-/}" echo "$VERSION"