[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: csh: how to use indirect ref to env vars



On Wed, 2008-06-25 at 15:02 +0100, Wackojacko wrote:
> michael wrote:
> > Hi, I have a csh script in which I'd like to do set up a list of vars
> > and then to chk each of these are set, something like the below.
> > However, I can't find the magic incantation that allows to to check
> > ${$Vars} eg if $InMetFiles is set on the first loop - suggestions
> > welcome!
> > 
> > #!/bin/csh
> > foreach Vars (InMetFiles InTerFile OutDir)
> >   echo Checking $Vars\.\.\.
> >   if ( ${?Vars} == 0) then
> >     echo $Vars not set \- aborting
> >     exit 1
> >   endif
> > end
> > 
> 
> maybe use "" (empty string) instead of 0 in the comparison.

but I want to check that $InMetFiles is non-empty and then check
$InTerFile is non-empty, not that $Vars is non-empty...


Reply to: