Help Passing An Oracle parameter to a unix shell.

I have an Oracle concurrent program that I'm passing a parameter to a unix shell script. An example value of the Oracle parameter is PO_TOP. The Oracle parameter represents the unix env var PO_TOP, meaning, on the unix side there is env var called PO_TOP (ex value: /oradev/apps/po/11.0.3/). My goal is to passed the Oracle parameter to the unix script and have it behave like the unix env var $PO_TOP.

Example of the code in the script.
ora_base_dir=$1
echo "ora_base_dir: "$ora_base_dir
cd $ora_base_dir

--
This fails with a directory does not exist
the echo displays "ora_base_dir: PO_TOP"

Here is some examples of the not so brilliant stuff that I have tried:
ora_base_dir=$$1
ora_base_dir=$\$1
ora_base_dir=${$1}

All failed.

Can you pass the name of a unix env variable to a unix shell script and then set a new unix var to the passed variable?

Note: I'm trying to avoid using
IF $1= 'PO_TOP' THEN
ora_base_dir=$PO_TOP
ELSIF $1 = 'FND_TOP' THEN
ora_base_dir=$FND_TOP.....etc

There are over 200 unix TOP variables.

Is PO_TOP a variable name in a PL/SQL script?

No. It is a parameter in an Oracle current program. The Oracle current program is a host script; In this case it will be a unix shell script. No sql or pl/sql is involved.

There are several ways to pass variables out of a shell script
one:

# write the variables
( echo "PO_TOP=/somedir/somewhere"
  echo "UO_TOP=/anotherdir/somewhere"
) > env.txt
# if you want aboslutely everything in the environment
env > env.txt
# get the variables
while read cmd
do
   eval $cmd
done < env.txt

Another way is to have script that needs to get the variables sourced by the script that creates them:

#!/bin/ksh
# i am the script that needs my env vars set

. ./otherscript.sh     # this script creates them and does other work.
# i now have all my variables set

Thx, Jim. I don't think I'm clear on what I'm asking.
But basically, I'm passing the name of unix env var from my Oracle current program to the unix shell. To the shell script; it is $1 parameter.

If I do "echo $1". It will display PO_TOP. If I do "cd $1" it fails because the directory PO_TOP does not exist.

There is an unix env var call PO_TOP If do I "echo $PO_TOP". It will display "/oradev/apps/po/11.0.3". If I do "cd $PO_TOP" it works because the directory exists.

I'm bascially wanting to pass the name of unix env var to a shell script.

Hi,
You mean that You want to pass the name of a variable but use the value ,right?
Can You pass in $PO_TOP instead of PO_TOP?

Otherwise, maybe You can use something like

eval cd '$'$1

This would "build" a command (resulting in "cd $PO_TOP" or actually "cd /oradev/apps/po/11.0.3") from evaluating its components and execute it.

/Lakris

Thxs Lakris, this is exactly what I want to do. The eval cd '$'$1 works like a champ. How can I set it to an unix var. Example:

ora_base_dir=eval cd '$'$1

I know the above does not work; but that is what I like to do.

It can also be used to define tables (variables with indices) as follows:

>i=3
   assign a value to a3:
>eval a$i=gaga
   retrieve the value of a3:
>eval a='$'$(echo a$i)
>echo $a
gaga

Limit: it does not work if there are spaces in the value that is assigned.