mercredi 14 janvier 2015

Print file name extension using -exec in find


I am playing around with -exec flag of find command. I am trying to use the flag to print the extension name of files, using a fairly new Linux distribution release.


Starting simple, this works:



find . -type f -exec echo {} \;


An attempt to use convenient Bash string feature fails:



find . -type f -exec echo "${{}##*.}" \; (bad substitution)


So what should be the correct way to do it?



Aucun commentaire:

Enregistrer un commentaire