home *** CD-ROM | disk | FTP | other *** search
- From: kevinl@tisdec.tis.tandy.com
- Date: 05 Nov 92 15:23 CST
- Newsgroups: comp.unix.shell
- Subject: Re: Variable substitution using Korn sh
- Message-ID: <28300008@tisdec.tis.tandy.com>
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!cs.utexas.edu!news.uta.edu!utacfd.uta.edu!trsvax!trsvax!tisdec.tis.tandy.com!kevinl
- Nf-ID: #R:lll-winken.LLNL.GOV:140617:tisdec.tis.tandy.com:28300008:000:479
- Nf-From: tisdec.tis.tandy.com!kevinl Nov 5 15:23:00 1992
- References: <140617@lll-winken.LLNL.GOV>
- Lines: 25
-
-
- That was a great question. I couldn't figure out how to do it,
- so I asked on of my co-workers. He showed me how, and I addapted it to
- your question. Here's what I have:
-
- --Start--
- :
- echo -n "Enter environment variable: "
- read variable
-
- dirnam=$(eval echo $"$variable")
-
- if [[ -d $dirnam ]]; then
- print $dirnam' to be scanned'
- else
- print $dirnam' not found'
- fi
-
- exit 0
- --Stop--
-
- This worked fine both in ULTRIX and SCO with Korn.
-
- Hope this helps. It was interesting ;-)
-
-