1844628 Members
4347 Online
110233 Solutions
New Discussion

.profile setup

 
SOLVED
Go to solution
Prashant Zanwar_4
Respected Contributor

.profile setup

Hi,
I have a problem ..

- .profile calls a file called cron.profile and sets up ORACLE_SID, ORACLE_HOME.
While I have put echo $ORACLE_SID & echo $ORACLE_HOME at the end of ecript cron.profile, which shows me proper as I turned on set -vx in the script.

But when script finishes executing and I get the shell back, I do not see this variables set..
Any clue on this?

Appreciate responses in advance
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: .profile setup

Hi Prashant:

You need to export the variables. For example:

# export ORACLE_HOME=/apps/oracle/8.1.7

Regards!

...JRF...
Indira Aramandla
Honored Contributor

Re: .profile setup

Hi Prashant,

Yes you will need to export the variable after assigning the path.

export ORACLE_HOME=/opt/oracle/product/92

export ORACLE_SID=



IA
Never give up, Keep Trying
Prashant Zanwar_4
Respected Contributor

Re: .profile setup

It's exported, but what I am thinking is, script which is called in .profile is not returning variable to .profile which is parent shell..which is a normal behaviour of Unix.. sounds ok ?

Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: .profile setup

You can't use a .profile like this because you are calling it as a child process. You need to source the .profile via the shell's . operator.

e.g.
~/.profile is very different from
. ~/.profile

You want the .profile to become part of the foreground process rather than simply a child process because one of the the fundamental tenets of UNIX is that a child cannot alter the environment of its parent.
If it ain't broke, I can fix that.
Geoff Wild
Honored Contributor

Re: .profile setup

Don't call a script (as Clay says) - source the cron.profile file instead...

. ./somepath/cron.profile

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Prashant Zanwar_4
Respected Contributor

Re: .profile setup

Thanks guys for responses .. Last two responses are answers for my question..I appreciate it..
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Prashant Zanwar_4
Respected Contributor

Re: .profile setup

Thanks
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."