home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4561 < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.9 KB  |  47 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sun-barr!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: Variable substitution using Korn shell
  5. Message-ID: <mcook.720988572@fendahl.dev.cdx.mot.com>
  6. Keywords: KORN Variables
  7. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  8. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  9. Organization: Motorola Codex, Canton, Massachusetts
  10. References: <140617@lll-winken.LLNL.GOV> <1992Nov5.010000.9474@oracle.us.oracle.com>
  11. Date: Thu, 5 Nov 1992 18:36:12 GMT
  12. Lines: 33
  13.  
  14. eginsber@oracle.com (Eric Ginsberg) writes:
  15.  
  16. >In article <140617@lll-winken.LLNL.GOV>, 946753@arniew.llnl.gov (Arnie Weinstein) writes:
  17. >>  I have a global variable named  ASCOM.
  18. >>  ASCOM=/home/aisserver1/people/946753
  19. >>   The following is the script which reads from standard input the variable
  20. >> dirnam.  Then it test to see if the the contents of dirnam is a directory.  If I
  21. >> enter the full file name manually it works fine, however if I use $ASCOM it does
  22. >> not work.  Instead of substituting the value of $dirname it uses $ASCOM.  If the
  23. >> value of dirnam comes from an input parameter $1 it evalutes the content of $1
  24. >> proprely.  How do I get dirnam to contain the value of $ASCOM not to contain the
  25. >> charaters '$ASCOM'   ????? 
  26. >> 
  27. >> *********************************************************************************
  28. >>  read  dirnam
  29. >>  if [[ -d $dirnam ]]
  30. >>       then 
  31. >>       print $dirnam' to be scanned'
  32. >>    else
  33. >>       print $dirnam' not found'
  34. >>    fi
  35. >> *********************************************************************************
  36. >> 
  37.  
  38. >Don't feel bad, you're real close.  What you're missing is the eval. 
  39. >Add this line in after the read dirnam
  40. >dirnam=`eval echo $dirnam`
  41.  
  42. Or this line:
  43.  
  44.   eval dirname=$dirname
  45.  
  46. Michael.
  47.