I am trying to learn how a couple of commands works and I want to make a simple script that will change uppercase letters in file names to lowercase. I created that script:
find * -exec bash -c \
'echo "${1##*/}" | tr "[:upper:]" "[:lower:]";' _ {} \;
It works, but it only writes with echo lowercased file names, instead of changing them. On the other hand this piece of code:
find * -exec bash -c \
'tr "[:upper:]" "[:lower:]";' _ {} \;
acts as if I would only use:
tr "[:upper:]" "[:lower:]"
So, I want to learn and understand how to pass filenames that I can get from find
and do anything with them using tr
. Went already to manuals and google and found nothing.