From owner-freebsd-questions Sun Oct 14 18:29: 4 2001 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id 8FD7737B405 for ; Sun, 14 Oct 2001 18:29:00 -0700 (PDT) Received: from [212.238.77.116] (helo=buffy.raggedclown.net) by post.mail.nl.demon.net with esmtp (Exim 3.22 #1) id 15swYt-0004Tn-00 for freebsd-questions@FreeBSD.ORG; Mon, 15 Oct 2001 01:28:59 +0000 Received: by tanya.raggedclown.net (Ragged Clown Mailhost, from userid 500) id DB762111C; Mon, 15 Oct 2001 03:28:39 +0200 (CEST) Date: Mon, 15 Oct 2001 03:28:39 +0200 From: Cliff Sarginson To: freebsd-questions@FreeBSD.ORG Subject: Re: sh script question Message-ID: <20011015032839.A2423@raggedclown.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.16i In-Reply-To: ; from doug@safeport.com on Sun, Oct 14, 2001 at 09:09:30PM -0400 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 On Sun, Oct 14, 2001 at 09:09:30PM -0400, doug@safeport.com wrote: > I want to read a file line-wise. The following: > _______________ > #!/bin/sh > USER="doug" > FILE="newuser.form" > > if [ ! -e ${FILE:-$1} ]; then > echo "File: ${FILE:-$1} not found" > exit 1 > fi > > for Line in `cat ${FILE:-$1}`; do > echo $Line > done > --------------- > > gives the file a field per read. The field delimiter being blank/whitespace. The > obvious answer would seem to be "IFS=" but I can not figure out the > syntax or even if that is possible. > It is possible... IFS=" " Where obviously you hit the key straight after the opening " -- Regards Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message