From owner-freebsd-hackers Mon Oct 1 3:41: 0 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bugz.infotecs.ru (bugz.infotecs.ru [195.210.139.22]) by hub.freebsd.org (Postfix) with ESMTP id D580E37B40C for ; Mon, 1 Oct 2001 03:40:55 -0700 (PDT) Received: (from root@localhost) by bugz.infotecs.ru (8.11.6/8.11.4) id f91AdOD88292 for freebsd-hackers@freebsd.org; Mon, 1 Oct 2001 14:39:24 +0400 (MSD) (envelope-from vel) From: "Eugene L. Vorokov" Message-Id: <200110011039.f91AdOD88292@bugz.infotecs.ru> Subject: how to make 'for' understand two words as a single argument To: freebsd-hackers@freebsd.org Date: Mon, 1 Oct 2001 14:39:24 +0400 (MSD) X-Mailer: ELM [version 2.5 PL5] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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