Ad

Make a Function that returns a comma separated list in the order of

"DirectoryName, Filename, FileExtension"

#!/bin/bash
filename=$1
echo "$(dirname $filename), $(basename ${filename%.*}), ${filename##*.}"

Try to return the File Extension from the provided arguement.

#!/bin/bash
file1=$1; echo ${file1##*.}