Retrieving the file name and extension in Bash can be completed using
basename and shell parameter expansion.
Get the file name
Using the native unix
basename command, the file name can be extracted from the path.
Get the file extension
Using shell parameter expansion, the prior example can include capturing the file extension:
Match on file extension using a
If there is conditional logic required for specific file extensions, a
case statement may be used. In addition, this is standard
sh (not exclusive to