Strings In Depth15 / 17
Up next

Strip a suffix

#!/usr/bin/env bash
file="archive.tar.gz"
# % removes the shortest trailing match, %% the longest
echo "${file%.*}"
echo "${file%%.*}"
What you're solving

${s%pattern} removes a trailing match