shell script question
Sorry, I'm full of questions today.
I'm working on a script that can rename filenames. For now I want it to add
an underscore before each capital letter there is in the filename and make
the capital letter lowercase: e.g. FileName --> _file_name.
I tried many things like:
for a in *; do mv $a `echo $a | tr [A] [_a]`;done
just to try with the letter A. I used quotes in various places, but it
converts A in _ and not _a. I also tried the -c switch with tr, but that
messed up thing quite badly.
So basically my question is 'how to translate one character into two and
vice versa?' Anyone? Thanks for the input.