Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Aug 2007 10:35:44 -0400
From:      Robert Huff <roberthuff@rcn.com>
To:        questions@freebsd.org
Subject:   semi OT: sh scripting problem
Message-ID:  <18096.39488.530454.883753@jerusalem.litteratus.org>

next in thread | raw e-mail | index | archive | help

	(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:

	foo
	bar grill
	baz

	If I do "cat FILE", everything comes out fine.
	If, however, I write a script:


	#!/bin/sh

	for i in `cat FILE`
	do
		.
		.
		.
		.
	done

	$i is set to

	foo
	bar
	grill
	baz

	Is there a way within the script - or, failing that, by
modifying FILE - to not break at the whitespace?


				Robert Huff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18096.39488.530454.883753>