Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Env variables not being set in the script

Status
Not open for further replies.

antzzz

Programmer
Mar 9, 2001
85
AE
Hi,

I'm sort of a newbie in Unix. I created a script which tries to set some env variables. I believe I'm using the Korn Shell. I made it executable by doing chmod 711. When I run the script, the env variables are not being set. But I don't get any errors.

Actually, my login is "oracle" which is used to manage the databases on the server and I don't have any access to the root password.

Am I doing something wrong?

Pls advise.

Thanks
 
You really need to post an example of how you are setting your environment variables in your script. The only thing I can think of off hand is that in the Bourne and Korn shell scripts you have to export the environment variable after the set it.
 
bfitzmai is quite correct. You can set and export the variables using simple export VARNAME=value in your .profile. Post an example of how you are setting the variables and we should be able to help further. Simple echo VARNAME statemants in the script will also tell you what a variable's value (if anything) is.
 
Additionally, you need to be aware that when you run a script you do so in its own "process space". So if you set environmental variables in /tmp/my_script and run as:
/tmp/my_script
you won't affect your current "process space".
However if you use:
. /tmp/my_script
you run the script in your current "process space", thus setting (or re-setting) your current environmental variables.

I hope that helps.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top