From owner-freebsd-questions@FreeBSD.ORG Fri Oct 14 20:14:48 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 0C92A16A41F for ; Fri, 14 Oct 2005 20:14:48 +0000 (GMT) (envelope-from drew@mykitchentable.net) Received: from relay04.roc.ny.frontiernet.net (relay04.roc.ny.frontiernet.net [66.133.182.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9980543D46 for ; Fri, 14 Oct 2005 20:14:47 +0000 (GMT) (envelope-from drew@mykitchentable.net) Received: from filter01.roc.ny.frontiernet.net (filter01.roc.ny.frontiernet.net [66.133.183.68]) by relay04.roc.ny.frontiernet.net (Postfix) with ESMTP id 06A283581D2; Fri, 14 Oct 2005 20:14:47 +0000 (UTC) Received: from relay04.roc.ny.frontiernet.net ([66.133.182.167]) by filter01.roc.ny.frontiernet.net (filter01.roc.ny.frontiernet.net [66.133.183.68]) (amavisd-new, port 10024) with LMTP id 07934-01-21; Fri, 14 Oct 2005 20:14:46 +0000 (UTC) Received: from blacklamb.mykitchentable.net (67-51-164-214.dsl1.elk.ca.frontiernet.net [67.51.164.214]) by relay04.roc.ny.frontiernet.net (Postfix) with ESMTP id B5C293580B5; Fri, 14 Oct 2005 20:14:34 +0000 (UTC) Received: from [165.107.42.123] (unknown [165.107.42.123]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by blacklamb.mykitchentable.net (Postfix) with ESMTP id A4A7E1549FC; Fri, 14 Oct 2005 13:14:33 -0700 (PDT) Message-ID: <43501135.2010106@mykitchentable.net> Date: Fri, 14 Oct 2005 13:12:37 -0700 From: Drew Tomlinson User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Will Maier References: <435007F3.8000106@mykitchentable.net> <20051014200526.GP29905@localdomain> In-Reply-To: <20051014200526.GP29905@localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-2.3.2 (20050629) at filter01.roc.ny.frontiernet.net Cc: freebsd-questions@freebsd.org Subject: Re: Help With 'for' Loop X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2005 20:14:48 -0000 On 10/14/2005 1:05 PM Will Maier wrote: >On Fri, Oct 14, 2005 at 12:33:07PM -0700, Drew Tomlinson wrote: >[...] > > >>Yet 'echo $i' only returns "/multimedia/Pictures/1998", stopping >>at the first space. Is it possible to get 'i' to represent the >>whole string that 'find' returns? If so, how? >> >> > >Bourne-style for loops use as the delimiter by default. To >change this behavior, modify the IFS variable (which is mentioned >but not explained in the sh manpage): > > $ OLDIFS=$IFS # probably want to remember this value > $ IFS=: > $ export $IFS > $ for i in $PATH; do > echo $i > done > /home/will/bin > /usr/local/sbin > /usr/local/bin > /usr/sbin > /usr/bin > /sbin > /bin > /usr/X11R6/bin > /opt/ > /usr/games/ > $ IFS=$OLDIFS # set it back to normal > $ export $IFS > $ for i in $PATH; do > echo $i > done > /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/:/usr/games/ > > Thanks for this explanation. I will look at the sh man page. Cheers, Drew -- Visit The Alchemist's Warehouse Magic Tricks, DVDs, Videos, Books, & More! http://www.alchemistswarehouse.com