renaming directories from upper case to lower case, help!!
Hello Linux Gurus,
I am pretty new to linux but have lot of passion to learn, I stumbledupon a script from a website and I couldn't possibly understand the hilighlighted peice of code. I really appreciate if you could help me understand this syntax. having trouble with the following code g=`expr "xxx$f" : 'xxx\(.*\)' | tr '[A-Z]' '[a-z]'` The complete code for f in *; do g=`expr "xxx$f" : 'xxx\(.*\)' | tr '[A-Z]' '[a-z]'` mv "$f" "$g" done This code was found in the following url webxadmin.free.fr/article/shell-rename-all-files-in-subdirectories-to-lowe-135.php |
Code:
# a=string |
Thanks but I want to understand the higlighted code.
Quote:
g=`expr "xxx$f" : 'xxx\(.*\)' | tr '[A-Z]' '[a-z]'` I appreciate gurus help here. Thanks teller |
Actually I'm not getting any difference whether or not I put the 'xxx' part is there in the expr section.
I made these 3 files: F ILE1 FIL -E2 fIlE3 Now I run the script given in that link (last line is replaced with echo instead of mv): Code:
bash-2.05b ~/scrap$ for f in *; do Code:
bash-2.05b ~/scrap$ for f in *; do Code:
g=`expr "$f" : '\(.*\)' | tr '[A-Z]' '[a-z]'` | tr '[A-Z]' '[a-z]'... and passes it to the tr commands which changes the case. So maybe someone else here knows how prefixing 'xxx' in the regex helps. |
All times are GMT -5. The time now is 11:10 AM. |