From owner-freebsd-questions@FreeBSD.ORG Wed Aug 18 00:37:12 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD89110656A5 for ; Wed, 18 Aug 2010 00:37:12 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3F5B58FC14 for ; Wed, 18 Aug 2010 00:37:11 +0000 (UTC) Received: by wyj26 with SMTP id 26so69318wyj.13 for ; Tue, 17 Aug 2010 17:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=fGjwzpS1QQK8O+ae5GJ9/yaJEXngEZxYuSftdy9/31Q=; b=ema7XZIlQwZl22IpTJDjLT2bZnwx2T+0E9scoAjMC5PnCp3vRKedLBNR6N5q6gJTIl dfQKUtyAxOYbQpi3dQfVx/6t0a289qnq2x1kDyDEBUYdoKmDj3yzAMm9l+K4TlY0xnDw OcVS35NgWM8iKZpbpMT4SbgWyajKmJwB4T6jw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=NYnW8p9mdbBUd+TdC5ev+4Q6ikuG8ee+DN4bvfVefudFmHXF3TnvoGDNh+F8XZnUBS p1HkUuX6pX9rginaUxmVe1/9toGiM6GX+mSHnpGC0YpUWc68kVlbphRtHmEWd5hf0NkY DHhF1ehsG2e+6r5WeIc2BP4FYvCZcwnetNayk= Received: by 10.227.157.200 with SMTP id c8mr6512844wbx.69.1282091831094; Tue, 17 Aug 2010 17:37:11 -0700 (PDT) Received: from localhost (ks369417.kimsufi.com [94.23.44.129]) by mx.google.com with ESMTPS id a1sm7036413wbb.20.2010.08.17.17.37.08 (version=SSLv3 cipher=RC4-MD5); Tue, 17 Aug 2010 17:37:09 -0700 (PDT) From: Anonymous To: Drew Tomlinson References: <4C6AA0FD.8000100@mykitchentable.net> <4C6AAAA8.9030204@mykitchentable.net> Date: Wed, 18 Aug 2010 04:37:02 +0400 In-Reply-To: <4C6AAAA8.9030204@mykitchentable.net> (Drew Tomlinson's message of "Tue, 17 Aug 2010 08:28:40 -0700") Message-ID: <86bp90ycwh.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: FreeBSD Questions Subject: Re: Bash Script Help - File Names With Spaces -- SOLVED 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: Wed, 18 Aug 2010 00:37:12 -0000 Drew Tomlinson writes: > It finally occurred to me that I needed the shell to see a new line as > the delimiter and not whitespace. Then a simple search revealed my > answer: > > O=$IFS > IFS=$(echo -en "\n\b") > > IFS=$O Old IFS value can be preserved by using `local' keyword or (...) braces, too. It's a bit better than polluting global scope with temporary variable. $ echo -n "$IFS" | (vis -w; echo) \040\^I\^J $ for i in $(find . -type f); do echo $i; done ./My Long File Name ./Another File $ f() { local IFS=; eval "$@"; } $ f 'for i in $(find . -type f); do echo $i; done' ./My Long File Name ./Another File $ (IFS=; for i in $(find . -type f); do echo $i; done) ./My Long File Name ./Another File $ echo -n "$IFS" | (vis -w; echo) \040\^I\^J