From owner-freebsd-questions@FreeBSD.ORG Wed Aug 1 15:00:49 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E22A16A420 for ; Wed, 1 Aug 2007 15:00:49 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.184]) by mx1.freebsd.org (Postfix) with ESMTP id 2B8CF13C4A3 for ; Wed, 1 Aug 2007 15:00:48 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: by mu-out-0910.google.com with SMTP id w9so213650mue for ; Wed, 01 Aug 2007 08:00:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=PA7GTmH16AYbLw1z9t9kkdvYpcE2kyzjZ3ulKzTGOu83yEXZXupdYyR9d/UgdoCEvkBffIzHPVf1dTwboW+aK7L3O71qSMTnm+HKP9Y8ZzjLoBz5uqQxuEcfBx+DpE6O6CZy2u/vwRF6bIiYwJHr8fjGnSCyy96NT50baaKvve4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=ao8onsddQLcVjgHZiwtFwfLJfzyoGOsp3gWH7pMYUbDIhpv/A/9LLpvoDTFlhtJpniOithAvezNnQG7M7bT8B9z95xVnqdP4pn98oU83IQeF7JUaKbAb5qTDylTsvi6gAc+t/4wiewxux4xQCNl2jm3RVfhd25f+J6JL2Kty+Y4= Received: by 10.82.170.2 with SMTP id s2mr951597bue.1185980447909; Wed, 01 Aug 2007 08:00:47 -0700 (PDT) Received: from ?127.0.0.1? ( [217.206.187.79]) by mx.google.com with ESMTPS id i4sm4171133nfh.2007.08.01.08.00.46 (version=SSLv3 cipher=RC4-MD5); Wed, 01 Aug 2007 08:00:47 -0700 (PDT) From: Tom Evans To: Robert Huff In-Reply-To: <18096.39488.530454.883753@jerusalem.litteratus.org> References: <18096.39488.530454.883753@jerusalem.litteratus.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-o4b4NZ6ZYGO4kiIfYDfY" Date: Wed, 01 Aug 2007 16:00:45 +0100 Message-Id: <1185980445.1444.17.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 FreeBSD GNOME Team Port Cc: questions@freebsd.org Subject: Re: semi OT: sh scripting problem 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, 01 Aug 2007 15:00:49 -0000 --=-o4b4NZ6ZYGO4kiIfYDfY Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2007-08-01 at 10:35 -0400, Robert Huff wrote: > (This is probably a FAQ, and I'll take a pointer (or even the > magic words to identify the problem) instead of an answer.) > Let's suppose I have a file FILE, with contents: >=20 > foo > bar grill > baz >=20 > If I do "cat FILE", everything comes out fine. > If, however, I write a script: >=20 >=20 > #!/bin/sh >=20 > for i in `cat FILE` cat FILE | while read i > do > . > . > . > . > done >=20 > $i is set to >=20 > foo > bar > grill > baz >=20 > Is there a way within the script - or, failing that, by > modifying FILE - to not break at the whitespace? >=20 >=20 > Robert Huff --=-o4b4NZ6ZYGO4kiIfYDfY Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQBGsKAZlcRvFfyds/cRAq7yAKCFeo+dXYT2wL3FwRQecqmghQXARACePL6g ENY9zHZemzocM94t+o5yWuY= =3fxw -----END PGP SIGNATURE----- --=-o4b4NZ6ZYGO4kiIfYDfY--