Re: initialising env var using sqlplus

From: <jl34778_at_corp02.d51.lilly.com>
Date: 14 Sep 94 08:27:28 EST
Message-ID: <1994Sep14.082728.1_at_corp02.d51.lilly.com>


In article <355cor$n1c_at_nuscc.nus.sg>, med10054_at_nusunix2.nus.sg (NORHISHAM BIN MAIN) writes:
>
> hi ...
>
> 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.

-- 
Bob Swisshelm                | swisshelm_at_Lilly.com     | 317 276 5472
Eli Lilly and Company        | Lilly Corporate Center  | Indianapolis, IN 46285
Received on Wed Sep 14 1994 - 15:27:28 CEST

Original text of this message