home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4559 < prev    next >
Encoding:
Internet Message Format  |  1992-11-07  |  1001 b 

  1. From: kevinl@tisdec.tis.tandy.com
  2. Date: 05 Nov 92 15:23 CST
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: Variable substitution using Korn sh
  5. Message-ID: <28300008@tisdec.tis.tandy.com>
  6. 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
  7. Nf-ID: #R:lll-winken.LLNL.GOV:140617:tisdec.tis.tandy.com:28300008:000:479
  8. Nf-From: tisdec.tis.tandy.com!kevinl    Nov  5 15:23:00 1992
  9. References: <140617@lll-winken.LLNL.GOV>
  10. Lines: 25
  11.  
  12.  
  13.     That was a great question.  I couldn't figure out how to do it,
  14. so I asked on of my co-workers.  He showed me how, and I addapted it to
  15. your question.  Here's what I have:
  16.  
  17. --Start--
  18. :
  19. echo -n "Enter environment variable: "
  20. read variable
  21.  
  22. dirnam=$(eval echo $"$variable")
  23.  
  24. if [[ -d $dirnam ]]; then
  25.     print $dirnam' to be scanned'
  26. else
  27.     print $dirnam' not found'
  28. fi
  29.  
  30. exit 0
  31. --Stop--
  32.  
  33.     This worked fine both in ULTRIX and SCO with Korn.
  34.  
  35.     Hope this helps.  It was interesting ;-)
  36.  
  37.