title: Get extension of files in Bash
body: <p>I am writing a script which will sort files by extensions. I know a method to do this by file's names. The problem is, that same files haven't got extension in their names. For example if I have file: <code>file.txt</code> there is no problem to get an extension by simple <code>extension="${filename##*.}"</code>. But if file name is just <code>filename</code> this method doesn't work. Is there any other option to get extension of file and put it to variable in Bash script?</p>