There’s nothing to turn in on that one. It’s just a for-your-own-good exercise.
]]>Ah, very nice. Thanks!
]]>On the “same file” problem, it may be that you are operating on your H: drive, which is really a Windows share. Windows ignores case differences, whereas Linux is case-sensitive.
I like the tr generalization of fixext. If you wanted, you could use the :l modifier to lowercase the variable during expansion. For example, ${file:e:l}. Man zshexpn to see all your options.
]]>When I run the script, however, I get this:
mv: `badname.JPG' and `badname.jpg' are the same file
mv: `foobar.JPG' and `foobar.jpg' are the same file
mv: `PICTURE.JPG' and `PICTURE.jpg' are the same file
OOoooOOOooOOOOH! I guess mv is doing more than just renaming the files. Why did this work during your class demo, though?
Also, here is my super cool version of fixext. YAAAYYYY shell!
#!/usr/bin/env zsh
for file in $*; do
mv $file ${file:r}.$(echo ${file:e} | tr '[:upper:]' '[:lower:]')
done