Find and -exec and why doesn’t basename work in there?

Ever wonder why this doesn’t work to rename all your isos to .nrg?

The thing is, the backticks are a bash construct, and whatever you specify to -exec does *not* get shell-expanded. So it’s being passed verbatim, with the only substitution being the {} for the found filenames.

But this works! (though quoting may pose some challenges). This works because it *is* being processed through bash, so all the normal expansion and shell tricks will work.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.