#!/bin/bash URL="ftp://ftp.osuosl.org/pub/xiph/releases/cdparanoia/" # Get version number from FTP server VERSION=$(curl -s --list-only "$URL" | grep -o -P 'cdparanoia-III-[\d.]+.src' | tail -n1) # Remove prefix VERSION=${VERSION//cdparanoia-III-} # Remove suffix VERSION=${VERSION//.src} echo "$VERSION"