Problem with sh/ksh quoting

Paul John Falstad pfalstad at drops.Princeton.EDU
Thu Nov 1 04:21:32 AEST 1990


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

Try something like this:

$ IFS='
'
$ line='this
is
a test'
$ for i in $line
> do
> echo $i
> done
this
is
a test
$ ...


--
Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
I would bring back hanging, and go into rope.  I would cut off the more
disreputable parts of the body and use the space for playing fields.



More information about the Comp.unix.shell mailing list