From owner-freebsd-questions Sat Aug 10 7:16:33 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F339937B400 for ; Sat, 10 Aug 2002 07:16:29 -0700 (PDT) Received: from mxzilla1.xs4all.nl (mxzilla1.xs4all.nl [194.109.6.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2217743E5E for ; Sat, 10 Aug 2002 07:16:29 -0700 (PDT) (envelope-from rene@xs4all.nl) Received: from xs2.xs4all.nl (xs2.xs4all.nl [194.109.3.12]) by mxzilla1.xs4all.nl (8.12.3/8.12.3) with ESMTP id g7AEGRgJ037798 for ; Sat, 10 Aug 2002 16:16:27 +0200 (CEST) Received: (from rene@localhost) by xs2.xs4all.nl (8.11.6/8.11.6) id g7AEGRQ88516 for questions@freebsd.org; Sat, 10 Aug 2002 16:16:27 +0200 (CEST) (envelope-from rene) Date: Sat, 10 Aug 2002 16:16:27 +0200 From: rene@xs4all.nl To: questions@freebsd.org Subject: /bin/sh "for" giving filenames with space as multiple parts :-(( Message-ID: <20020810141627.GE76272@xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I have the following script; #!/bin/sh base=/mnt/xxl/unsorted #main if [ "1" != "0" ] then for x in $base/*; do if [ -d $x ] then for y in $x/*; do echo $y if [ `ls $y | wc -w` == 0 ] then echo empty $y else echo some $y fi done fi done fi #echo $0 finished But when I run this, the $y-for-loop returns directory names with spaces as several different items. I do not understand why, and would like to. Also, this is in general giving me headaches (IFs with mandatory spacing, bahhh). Shall I switch to perl or php? Greets from the perpetual newbie ;-) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message