sh `for' (was Help with strings in Bourne shell)

Chris Torek chris at mimsy.UUCP
Sun Apr 30 15:51:50 AEST 1989


In article <19311 at adm.BRL.MIL> mchinni at pica.army.mil (Michael
J. Chinni, SMCAR-CCS-E) writes:
>The problem is with the "for" loop. The "for" construct uses a list
>of arguments which are words separated by tabs/spaces.

Not quite:  `for' splits its list according to $IFS.  For instance:

	IFS=@
	l="color = red at size = big"
	for i in $l; do wc $i; done

(I use `wc' as a program that shows exactly what its arguments are;
echo puts each argument on the same line, which makes things hard to
see.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list