nested loops

Chet Ramey chet at cwns1.CWRU.EDU
Sat Aug 11 05:28:41 AEST 1990


In article <4103 at herbie.misemi> adley at herbie.misemi ( iccad) writes:

$ !# /bin/sh
$ this="one two three"
$ that="four five six seven"
$ them="eight nine ten"
$ all="this that them"
$ #
$ for i in $all
$ do
$ for j in $`echo $i`
$ do
$ echo $i $j
$ done
$ done

$ The problem lies in the  $`echo $i` statment
$ the `echo $i` preforms as expected and the result is one of this,
$ that, or them
$ the $ infront of this statment however is taken as a literal $
$ and does not return the value of the variable this or that or them
$ instead it returns $this or $that or $them.

Use `eval'.

Chet
-- 
Chet Ramey				``Levi Stubbs' tears run down
Network Services Group			  his face...''
Case Western Reserve University	
chet at ins.CWRU.Edu		



More information about the Comp.unix.wizards mailing list