Strip every extension from a name
Remove every extension from a name with ${f%%.*} in Bash. The doubled percent sign takes the longest match, where a single one stops at the last dot.
A file called backup.2026.sql.gz needs to become backup, so removing one suffix at a time is not enough.
f=backup.2026.sql.gz
printf 'shortest: %s\n' "${f%.*}"
printf 'longest: %s\n' "${f%%.*}"shortest: backup.2026.sql
longest: backupThe percent sign trims from the end of the value. One sign takes the shortest match of the pattern, two take the longest, and with .* the longest match starts at the first dot. The same single versus double rule applies to # and ## at the start of the value, as described in the Bash manual.
Everything after the first dot is gone, so a name that carries a dot in its real stem, such as v1.2-release.tar.gz, comes back as v1. When the stem can hold dots, strip a known list of suffixes instead, one ${f%.gz} at a time.