From owner-freebsd-questions@FreeBSD.ORG Fri Oct 14 20:05:36 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 EC33E16A41F for ; Fri, 14 Oct 2005 20:05:36 +0000 (GMT) (envelope-from willmaier@ml1.net) Received: from out3.smtp.messagingengine.com (out3.smtp.messagingengine.com [66.111.4.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8589C43D45 for ; Fri, 14 Oct 2005 20:05:33 +0000 (GMT) (envelope-from willmaier@ml1.net) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id EB9FDCD118E for ; Fri, 14 Oct 2005 16:05:31 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Fri, 14 Oct 2005 16:05:31 -0400 X-Sasl-enc: IJdVOd3cY12Ce74Uxf41rh+FfLJ/iq4VmIRnmDLCyXyF 1129320325 Received: from merkur (host-66-202-74-42.choiceone.net [66.202.74.42]) by frontend2.messagingengine.com (Postfix) with ESMTP id 7859E570363 for ; Fri, 14 Oct 2005 16:05:25 -0400 (EDT) Received: by merkur (nbSMTP-1.00) for uid 1000 willmaier@ml1.net; Fri, 14 Oct 2005 15:05:31 -0500 (CDT) Date: Fri, 14 Oct 2005 15:05:26 -0500 From: Will Maier To: freebsd-questions@freebsd.org Message-ID: <20051014200526.GP29905@localdomain> Mail-Followup-To: freebsd-questions@freebsd.org References: <435007F3.8000106@mykitchentable.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <435007F3.8000106@mykitchentable.net> User-Agent: Mutt/1.5.6+20040907i 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:05:37 -0000 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/ -- o--------------------------{ Will Maier }--------------------------o | jabber:..wcmaier@jabber.ccc.de | email:..........wcmaier@ml1.net | | \.........wcmaier@cae.wisc.edu | \..........wcmaier@cae.wisc.edu | *------------------[ BSD Unix: Live Free or Die ]------------------*