Date: Mon, 1 Oct 2001 14:39:24 +0400 (MSD) From: "Eugene L. Vorokov" <vel@bugz.infotecs.ru> To: freebsd-hackers@freebsd.org Subject: how to make 'for' understand two words as a single argument Message-ID: <200110011039.f91AdOD88292@bugz.infotecs.ru>
next in thread | raw e-mail | index | archive | help
Hello,
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;
for i in `find . -name "*" -type d -maxdepth 1`;\
do if [ $i != "." ]; then cd $i; echo "Processing sub-dir $i"; $0; cd ..; fi \
done;
It works fine unless some file or directory has a space in it's name.
It this case each word is interpreted as a separate argument by 'for'
and script doesn't find files.
I tried this:
for i in `ls |grep [A-Z] |awk '{printf("\"%s\"\n", $0);}'`; \
but it doesn't work either - I still get '"word1' and 'word2"'
separately.
How am I supposed to get this working ?
Regards,
Eugene
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110011039.f91AdOD88292>
