home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- 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
- From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
- Subject: Re: Variable substitution using Korn shell
- Message-ID: <mcook.720988572@fendahl.dev.cdx.mot.com>
- Keywords: KORN Variables
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: fendahl.dev.cdx.mot.com
- Organization: Motorola Codex, Canton, Massachusetts
- References: <140617@lll-winken.LLNL.GOV> <1992Nov5.010000.9474@oracle.us.oracle.com>
- Date: Thu, 5 Nov 1992 18:36:12 GMT
- Lines: 33
-
- eginsber@oracle.com (Eric Ginsberg) writes:
-
- >In article <140617@lll-winken.LLNL.GOV>, 946753@arniew.llnl.gov (Arnie Weinstein) writes:
- >> I have a global variable named ASCOM.
- >> ASCOM=/home/aisserver1/people/946753
- >> The following is the script which reads from standard input the variable
- >> dirnam. Then it test to see if the the contents of dirnam is a directory. If I
- >> enter the full file name manually it works fine, however if I use $ASCOM it does
- >> not work. Instead of substituting the value of $dirname it uses $ASCOM. If the
- >> value of dirnam comes from an input parameter $1 it evalutes the content of $1
- >> proprely. How do I get dirnam to contain the value of $ASCOM not to contain the
- >> charaters '$ASCOM' ?????
- >>
- >> *********************************************************************************
- >> read dirnam
- >> if [[ -d $dirnam ]]
- >> then
- >> print $dirnam' to be scanned'
- >> else
- >> print $dirnam' not found'
- >> fi
- >> *********************************************************************************
- >>
-
- >Don't feel bad, you're real close. What you're missing is the eval.
- >Add this line in after the read dirnam
- >dirnam=`eval echo $dirnam`
-
- Or this line:
-
- eval dirname=$dirname
-
- Michael.
-