#!/bin/bash URL="https://download.videolan.org/pub/videolan/x264/snapshots/" # Get version number from FTP server VERSION=$(curl -s -L "$URL" | grep -o 'x264-snapshot-.*.tar.bz2' | grep -o -E '[0-9]{1,}-[0-9]{1,}' | sort -V | tail -n1) # Replace '-' with '.' VERSION=${VERSION//-/.} echo "$VERSION"