Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.wizards Subject: Re: nested loops Message-ID: <1990Aug10.072359.5923@iwarp.intel.com> Date: 10 Aug 90 07:23:59 GMT References: <4103@herbie.misemi> <7318@helios.TAMU.EDU> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 38 In-Reply-To: skdutta@cs.tamu.edu (Saumen K Dutta) In article <7318@helios.TAMU.EDU>, skdutta@cs (Saumen K Dutta) writes: | this="one two three" | that="four five six seven" | them="eight nine ten" | all="this that them" | # | for i in $all | do | k='eval echo $`echo $i`' | for j in `eval $k` | do | echo $i $j | done | done Waaaaayyyy too many eval's and echo's. Try this: #!/bin/sh this="one two three" that="four five six seven" them="eight nine ten" all="this that them" for i in $all do eval 'for j in $'$i' do echo $i $j done' done And look, I didn't mention Perl once (oops!). (But why is this in wizards? Sigh.) -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/