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?
 
slightwv (䄆 Netminder)Connect With a Mentor 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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
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
 
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
All Courses

From novice to tech pro — start learning today.