This content has been marked as final. Show 8 replies
sounds like you want to source the variables (which is exactly what setting up the ALPHABETS in your profile did).
So, from the script that decides what the paths are, you would call the other shell scripts with a '.' before them (after you have set the paths)
( . /my/script/path/srcipt_name)
that will give the script that is being called the same environment as the one calling it.
using EXPORT just sets the variable for that session/script.
of course this will only work if you can use one script to set the paths and call the others from that one.
848265 wrote:We put all our "global" variables in a script called locvars. Every other script we write has the line
I have been using export command to declare variables for setting up the log folder path, data directory path, archive folder path, scripts folder path etc. in my shell scripts. E.g.
However, these variables with the same paths are used in multiple scripts, and with a small change in directory structure I have to reflect the changes across all the shell scripts. I would like to assign these variables as a global variables and want to maintain them at a single place, so that if any change comes I have to make ammendments at a single place rather than across all the files.
export datadir=(path1) export archive=(path2) export logs=(path3)
For example, I have aliased some routinely used directory path with ALPHABETS in my .profile, and whenever I log on to the session I run . .profile and then just have to type in those aliased alphabets to reach those directory paths. And in case any folder structure changes I have to make a change in .profile file only.
I need a solution something like this, I am litlle new to shell programming. Have googled how to declare kind of global variables in a shell script, but could'n get to the right link.
Also, could these variables be used in the sql*loader control file?
Note, that is dot, space, /usr/local/bin/locvars
I have used another shell script where in I declared all the paths that I need in the current script. Everything is running fine, however, it is failing at the sql*loader calling statement. Below is the code snippet and the error coming.
I did an echo of the $control_files before this sql*loader calling as well, and its returning correct path.
sqlldr userid=username@DB/password \ control=$control_files/nc_cntrol.ctl \ log=$control_files/nc_cntrol.log \ discard=$control_files/nc_cntrol.dis \ errors=50
But everytime when I run, its failing at this point.
The error capture in the logs is
Is it that we cannot use variables in sql*loader call statements?
LRM-00116: syntax error at '=' following '=' SQL*Loader-100: Syntax error on command-line