home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / shell / 3481 < prev    next >
Encoding:
Text File  |  1992-08-13  |  856 b   |  26 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!caen!destroyer!ubc-cs!news.UVic.CA!csr!stilley
  3. From: stilley@csr.uucp (Scott  Tilley)
  4. Subject: Re: unwinding $variables in csh
  5. Message-ID: <1992Aug13.180223.6446@sol.UVic.CA>
  6. Keywords: resolve, unwind $variables, csh
  7. Sender: news@sol.UVic.CA
  8. Nntp-Posting-Host: csr.uvic.ca
  9. Organization: University of Victoria, Victoria, BC, Canada
  10. References: <1992Aug9.194325.1476@sol.UVic.CA> <1992Aug12.230438.20870@Cigna.COM>
  11. Date: Thu, 13 Aug 92 18:02:23 GMT
  12. Lines: 12
  13.  
  14.  
  15. Well, using eval will work, but only for one layer of unwinding, if you
  16. will. The solution I came up with is:
  17.  
  18.   while ( $var =~ *\$* )
  19.     set var = `eval echo $var`
  20.   end
  21.  
  22. This just keeps looping as long as it finds a '$' in the current "val",
  23. and if so, eval's it. Messy, but works for me.
  24.  
  25.     ..Scott
  26.