Re: initialising env var using sqlplus

From: Larry Prall <pralll_at_hfsi.com>
Date: Fri, 16 Sep 1994 11:02:23 GMT
Message-ID: <9409160702.AA23807_at_lmacq.hfsi.com>


In article <1994Sep14.082728.1_at_corp02.d51.lilly.com>, jl34778_at_corp02.d51.lilly.com writes:
>
> In article <355cor$n1c_at_nuscc.nus.sg>, med10054_at_nusunix2.nus.sg
> (NORHISHAM BIN MAIN) writes:
> >
> > I'm trying to initialise a list of unix env variables using
> > values retrieved from sqlplus but has not had much success.
> >
> > What I did was the following piece of ksh script:
> > ------------------------------------------------------------------------
> > -
> > #! /bin/ksh
> > OUT_DIR='OUT_DIR
> > IN_DIR
> > UL_DIR
> > DL_DIR'
> >
> > for EACH_DIR in $OUT_DIR; do
> > $EACH_DIR=`echo "set feedback off
> > set heading off
> > select $EACH_DIR
> > from direcotories
> > where hostname='MY_HOST';" | sqlplus -s /` done
> >
> > export $OUT_DIR
> > ------------------------------------------------------------------------
> > -
> >
> > Has anyone done anything like this before ? Somehow the above piece
> > of code looks logical but it doesn't seem to work. Would appreciate
> > any advice greatly ...
> >
> > Thanxs !
> >
> > mars
>
> I think that the problem in how the K shell assigns variables.
>
> You can do this:
>
> OUT_DIR=fred
>
> but not this:
>
> EACH_DIR=OUT_DIR
> $EACH_DIR=fred
>
> The C shell seems to allow you to do this.
>

Try this:



#!/bin/ksh

set -- OUT_DIR IN_DIR UL_DIR DL_DIR

for EACH_DIR in "$*"; do

        ...
done


Received on Fri Sep 16 1994 - 13:02:23 CEST

Original text of this message