Sajha.com Archives
UNIX SHELL HELP!!!

   Any shell guru out there who can help me 04-Dec-02 dariwal
     Tetro Dariwal bhayera pani teti auuna:p 04-Dec-02 Rusty
       Sikaideuna Rusty bro 04-Dec-02 dariwal
         save this in a file. then chmod +ux <f 05-Dec-02 ?


Username Post
dariwal Posted on 04-Dec-02 09:22 PM

Any shell guru out there who can help me with this question? I would appreciate it.

For each file in the current directory, change its name so that any upper-case letters are changed to lower case. For example 'sAjHa.doC' will be changed to 'sajha.doc' Hint: generate a file that contains all the required mv operations, then execute that file

thanks
dariwal
Rusty Posted on 04-Dec-02 09:29 PM

Tetro Dariwal bhayera pani teti auuna:p
dariwal Posted on 04-Dec-02 09:30 PM

Sikaideuna Rusty bro
? Posted on 05-Dec-02 10:29 AM

save this in a file.
then chmod +ux

#!/bin/sh


ls * | while read f
do
if [ -f $f ]; then
if [ "$f" != "`echo \"$f\" | tr A-Z a-z`" ]; then
mv -iv "$f" "`echo \"$f\" | tr A-Z a-z`"
fi
fi
done

## eof