#!/bin/bash URL="ftp://ftp.gnu.org/gnu/aspell/dict/en/" # Get version number from FTP server VERSION=$(curl -s --list-only "$URL" | grep -E '^aspell6-en-[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}-0.tar.bz2$' | cut -d '-' -f3 | sort -V | tail -n1) # Remove '-0.tar.gz' suffix from VERSION variable VERSION=${VERSION//-0.tar.bz2/} echo "$VERSION"