home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!news.bbn.com!news.bbn.com!news
- From: cjross@bbn.com (chris ross)
- Newsgroups: comp.unix.shell
- Subject: Re: unwinding $variables in csh
- Keywords: resolve, unwind $variables, csh
- Message-ID: <l8kop0INNkpq@news.bbn.com>
- Date: 13 Aug 92 13:26:56 GMT
- References: <1992Aug9.194325.1476@sol.UVic.CA>
- Lines: 20
- NNTP-Posting-Host: bbn.com
-
- stilley@csr.UVic.CA (Scott Tilley) writes:
-
- >What is the easiest way to completely resolve variables in csh? I have
- >several variables that are made up of other $variables. I do not
- >want them expanded until the end of the script, so I use
-
- > set var1 = '$HOME'
- > set var2 = '$var1/dir'
-
- Use a while/eval loop, with continuation conditional on
- the presence of '$' in your variable:
-
- while ($var2 =~ *\$*)
- eval "set var2 = $var2"
- end
-
-
- chris ross <cjross@bbn.com> BBN Advanced Simulations (617) 873-3272
- WARNING: article may contain flammable material. Do not expose to open
- flames. In case of accidental ignition, douse keyboard with water.
-