bash cat file extension without name code example Example: remove file extension bash $ filename=foo.txt $ echo "${filename%.*}" foo