Hi,

2018-04-26 16:45 GMT+02:00, Rudolf Sykora <rudolf.syk...@gmail.com>:
> Hello
>
> I, using OpenBSD's p9p, see this
>
> % w='A
>     B
>     C'
> % echo $w
> A
> B
> C
> % for(i in $w) {echo $i; echo XXX}
> A
> B
> C
> XXX
>
> ie, w in for is taken as just one argument instead of
> 3. What can I do with it?
>
> I haven't modified ifs (it should be \n space and tab).
> (How can I check, say see the character codes?)
>
> Thanks for comments
> Ruda
>
>

; w='A
B
C'
; we=`{echo $w}
; for(i in $we) { echo 'arg '$i; }
arg A
arg B
arg C
; for(i in $w) { echo 'arg'$i; }
argA
B
C
; exit

When enclosed in single quotes, the variable is, regardless of spaces
or whatnot, a single element. For a list you have to expand it in some
way, inside a command expansion or declaring a list.

Reply via email to