"Daniel C. Sobral" wrote:
> "Eugene L. Vorokov" wrote:
> >
> > I have a script which is supposed to convert all filenames to lowercase
> > recursively from current directory. It looks like:
> >
> > echo "Processing files"
> > for i in `ls |grep [A-Z]`; \
> > do mv $i `echo $i |tr [A-Z] [a-z]`; echo $i;\
> > done;
ls |grep [A-Z] | while read i; \
do mv $i `echo $i |tr [A-Z] [a-z]`; echo $i;\
done
>
> > for i in `find . -name "*" -type d -maxdepth 1`;\
> > do if [ $i != "." ]; then cd $i; echo "Processing sub-dir $i"; $0; cd ..; fi \
> > done;
find . -name "*" -type d -maxdepth 1 | while read i; \
do if [ $i != "." ]; then cd $i; echo "Processing sub-dir $i"; $0; cd ..; fi \
done
Be aware that the pipe will launch a child shell for the while loop, so any variables
set inside the loop will get lost after 'done'
And, of course, the output of the first part of the pipe should be one file name per
line.
--
* * Konstantin Chuguev Francis House
* * Application Engineer 112 Hills Road
* Tel: +44 1223 302992 Cambridge CB2 1PQ
D A N T E WWW: http://www.dante.net United Kingdom
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message