Sometimes I can’t help but being amazed at the complex operations some people are ready to perform simple tasks.
A very common example: assume that you have a bunch of files in a directory and want to convert them all to lowercase. I’ve seen people write scripts for this. I’ve seen others up open up one of those GUI file manager thingies and rename the files one by one. Yet others will frantically browse through the sed manual, trying to figure out which regex will save the day. In either case, the operation tends to be accompanied by heavy breathing and bucket-loads of sweat. *sigh*
For a zsh user, no matter how you try to complicate it, it *is* a one-liner. The following is easy to understand and to memorize:
% for file in *; do mv $file ${file:l}; done
If you wanted to operate only on JPEG files:
% for img in *.jpg; do mv $img ${img:l}; done
If you are in a state of temporary or permanent insanity and need to upper-case instead:
% for f in *; do mv $f ${f:u}; done
There, no need anymore to create perl scripts, suffer sed or wait 20 minutes for you GUI file manager to start up ever again. Just keep it simple. This probably works in bash as well, but don’t take my word for it. I only use zsh and ksh.


