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