Problem with sh/ksh quoting

Paul Chamberlain tif at doorstop.austin.ibm.com
Fri Nov 2 03:02:46 AEST 1990


In article <16289 at s.ms.uky.edu> kherron at ms.uky.edu (Kenneth Herron) writes:
>	line="this is 'a test'"
>	...
>I *want* it to produce:
>this
>is
>a test

Nice challenge.  I finally got it, and you don't have to change things
as dramatically as other people had posted.  My method works like this:

	line='this is "a test"'
	eval set -- $line
	for word
	do
		echo $word
	done

I couldn't figure out how to get eval to work like this:

	eval for word in $line
	...

I'm gonna start calling myself "The Shell Answer-man".

Paul Chamberlain | I do NOT represent IBM.     tif at doorstop, sc30661 at ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmchs!auschs!doorstop.austin.ibm.com!tif



More information about the Comp.unix.shell mailing list