Nix: Extract file extension from file name

less than 1 minute read

If you need to know in a *nix script the extension of a file, try the following:

$ filename="abc.txt"
$ fileext="${filename##*\.}"
$ echo "${fileext}"
txt

Via SO.

Tags: ,

Categories:

Updated:

Comments