Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet From: chet@cwns1.CWRU.EDU (Chet Ramey) Newsgroups: comp.unix.wizards Subject: Re: nested loops Message-ID: <1990Aug10.192841.23503@usenet.ins.cwru.edu> Date: 10 Aug 90 19:28:41 GMT References: <4103@herbie.misemi> Sender: news@usenet.ins.cwru.edu Reply-To: chet@po.CWRU.Edu Distribution: na Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA) Lines: 32 In article <4103@herbie.misemi> adley@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@ins.CWRU.Edu