semi OT: sh scripting problem

Robert Huff roberthuff at rcn.com
Wed Aug 1 14:35:50 UTC 2007


	(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


More information about the freebsd-questions mailing list