how to remove the extension of a file in bash code example Example: remove file extension bash $ filename=foo.txt $ echo "${filename%.*}" foo