Hot to get the oracle directory path into the shell script?

Hi Experts,

I have some ftp script that uses inbound and outbound directory. This directory already created in the unix as oracle directories i.e.

inbound_dir as '/oratmp/inbound'
outbound_dir as '/oratmp/outbound'
arc_dir as '/oratmp/arc'

I need to get this directoies and pass it onto the FTP scrips inbound and outbound directories when are using put and get in FTP i.e.


ftp  @server_name
  quote user
  quote password
  get $inbound_dir
  put ${outbound_dir}/test.txt $inbound_dir/test.txt
  mv -f ${outbound_dir}/test.txt  ${arc_dir}/test.txt
endftp

Basically my question how to get the oracle directories (i.e. outbound_dir) in shell script. Please answer me ASAP, appreciate it.

--Victor
victory_inAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Naveen KumarProduction Manager / Application Support ManagerCommented:
since we know the directory paths, just have 3 variables  with the respective directory structures and use the variables in your script.

what is the error you are getting with your above script ?
0
victory_inAuthor Commented:
I don't want to hardcode the directory in the program. The directory name is constant thruout, but directory may change as we move on. So I would like to have the directory name not the directory structure in the program.
0
victory_inAuthor Commented:
with the above script it is detecting the directory within that directory name. It says directory inbound_dir doesn't exists.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

victory_inAuthor Commented:
with the above script it is NOT detecting the directory within that directory name. It says directory inbound_dir doesn't exists.
0
slightwv (䄆 Netminder) Commented:
Do you mean you have a directory created in Oracle ( create directory inbound_dir as '/some/path'; ) and want to extract it from the database and use them in shell variables?

I don't have access to UNIX right now but it should go something like (typed in so I'm sure there will be problems).

You can get a little fancier and pull both out at the same time and either go into a read loop twice (two rows from Oracle), or concatenate them with say a ',' and use UNIX cut to populate the shell variables.
#/bin/sh

sqlplus -s /nolog | read inbound_dir <<EOF
connect user/password
set pages 0
set feedback off
set echo off
select directory_path from all_directories where directory_name='INBOUND_DIR';
exit
EOF

echo $inbound_dir

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
victory_inAuthor Commented:
what a coooool stuff. This is what I want.  Whole bunch of thanks. keep up the good work

0
victory_inAuthor Commented:
Excellent
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.