🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #71

Variable substitution using Korn shell

#71
From: Arnie Weinstein
Date: Wed, 04 Nov 1992 18:37
34 lines
1795 bytes
I must be stupid or it can not be done.  I have develop several hundred lines
of KORN shell scripts and I have been able to do everthing I wanted to.  The one 
thing I have not figured out is variable substitution.

 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
*********************************************************************************

 I have tried:
 read  "dirnam"

 dirn=$echo($dirnam)
 if [[ -d $dirn ]]

 Thankyou for any help.  Seriously confused and stupified
                         Arnold Weinstein
                         Computer Scientist
                         L.L.N.L
Technical Details
Message-ID: <140617@lll-winken.LLNL.GOV>
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!arniew.llnl.gov!946753

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!arniew.llnl.gov!946753
From: 946753@arniew.llnl.gov (Arnie Weinstein)
Newsgroups: comp.unix.shell
Subject: Variable substitution using Korn shell
Keywords: KORN Variables
Message-ID: <140617@lll-winken.LLNL.GOV>
Date: 4 Nov 92 18:37:05 GMT
Sender: usenet@lll-winken.LLNL.GOV
Organization: Lawrence Livermore National Lab
Lines: 34
Nntp-Posting-Host: arniew.llnl.gov