02-23-2008
James is right about your setenv but your set statements are probably wrong too...
set ORACLE_SID=MYDB
Yeah, that syntax is correct to set a local variable to the c script, but that needs to be an envirorment variable. Like this...
setenv ORACLE_SID MYDB
And that shebang is troubling. It will take effect if you run this file as separate script. If you do that, you will create a new process, it will run the script and set some of its environment variables, then it will exit and the environment you set up will cease to exist. This file needs to be sourced by the interactive shell as you start to run. Then it will set the interactive shells environment. Also it might be sourced near the top of csh scripts that will need Oracle. But in each of these cases, you are effecting a csh that is already running.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I want to add paths to a CLASSPATH variable but if I use the :
setenv CLASSPATH /opt
all previous entries are erased. How do I append additional entries to a system variable without overwriting the original value.
Thanx (3 Replies)
Discussion started by: ianf
3 Replies
2. UNIX for Dummies Questions & Answers
Well first of all I am a real Unix newbie. I am taking a course on it in University. I kind of understand set and setenv but, I think it si something that I should really understand. So I thought that I would try a forum out and see how good you guys really are.
The question:
Execute the... (1 Reply)
Discussion started by: w6u6f
1 Replies
3. Shell Programming and Scripting
Hi
Is someone know about "setenv"? where can i find out this one?
Regards
Myoe (2 Replies)
Discussion started by: myoeminn
2 Replies
4. Shell Programming and Scripting
Hello,
I just want to know ow I can set permanent pathes or whatever using setenv command. I'm using c shell .
regards,
me (1 Reply)
Discussion started by: geoquest
1 Replies
5. Shell Programming and Scripting
Is it possible to set environement variable in a script (for example, perl script) so that the variable will be set after exiting the script - in a father shell. (2 Replies)
Discussion started by: kosta_mirkin
2 Replies
6. Programming
Hi
I have a problem with setenv function in C. I'm calling an .exe of a c program from my shell script. Now, I have to pass a value from the .exe to my shell script. So i have exported an variable in my script. And in the C program I'm setting the variable as
setenv("REC_CNT",rec_cnt,1);
... (7 Replies)
Discussion started by: janemary.a
7 Replies
7. UNIX for Dummies Questions & Answers
Hi,
Is there any difference between setting an environment variable by EXPORT and by setenv? (3 Replies)
Discussion started by: dexkid
3 Replies
8. UNIX for Dummies Questions & Answers
Hi whats the setenv command in unix..??
i have set the oracle_home path as aa.ii.1 in kron_settings and
mentioned setenv oracle_path as aa.ii.2 in user settings.
Does this make any changes made to the path name of the oracle_home when i run a scripts in unix..???:( (1 Reply)
Discussion started by: abhi_123
1 Replies
9. UNIX for Advanced & Expert Users
helllo every body ..
hope you are having good time programming in unix .
here is a little problem faced me :
setenv("myvar","bla bla",1);
system("myvar=$(grep....));
printf("%s\n", getenv("myvar"));
will print :
bla bla ..
how can i get the value of grep into my program ? ... (7 Replies)
Discussion started by: max_475
7 Replies
10. Solaris
Hi all!
I need to add new environment variable.
e.g. # setenv LD_LIBRARY_PATH "/usr/ucblib:"
#
I check:# env
LD_LIBRARY_PATH=/usr/ucblib:
After rebooting I don't see this variable.
Why don't save this variable?
Thanks. (5 Replies)
Discussion started by: wolfgang
5 Replies
LEARN ABOUT OPENSOLARIS
setenv
setenv(3C) Standard C Library Functions setenv(3C)
NAME
setenv - add or change environment variable
SYNOPSIS
#include <stdlib.h>
int setenv(const char *envname, const char *envval,
int overwrite);
DESCRIPTION
The setenv() function updates or adds a variable in the environment of the calling process. The envname argument points to a string con-
taining the name of an environment variable to be added or altered. The environment variable is set to the value to which envval points.
The function fails if envname points to a string which contains an '=' character. If the environment variable named by envname already
exists and the value of overwrite is non-zero, the function returns successfully and the environment is updated. If the environment vari-
able named by envname already exists and the value of overwrite is zero, the function returns successfully and the environment remains
unchanged.
If the application modifies environ or the pointers to which it points, the behavior of setenv() is undefined. The setenv() function
updates the list of pointers to which environ points.
The strings described by envname and envval are copied by this function.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned, errno set to indicate the error, and the environment is left
unchanged.
ERRORS
The setenv() function will fail if:
EINVAL The envname argument is a null pointer, points to an empty string, or points to a string containing an '=' character.
ENOMEM Insufficient memory was available to add a variable or its value to the environment.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
getenv(3C), unsetenv(3C), attributes(5), standards(5)
SunOS 5.11 31 Mar 2002 setenv(3C)