Bash: trim affixes from variable values
${variable%pattern} Trim the shortest match from the end ${variable##pattern} Trim the longest match from the beginning ${variable%%pattern} Trim the longest match from the end ${variable#pattern} Trim the shortest match from the beginning $ s="basics-01-understanding-the-course-project-starting-code.zip" $ echo ${s%.zip} basics-01-understanding-the-course-project-starting-code $ mkdir ${s%.zip} $ unset s https://tldp.org/LDP/LG/issue18/bash.html