04-24-2017
Set, setenv or export? Confused between three options
Hi Experts,
Need your help in understanding the commands to setup the environment variables in hp-ux.
Beleive need to use either set,setenv or export.
I am confused between above three options, when to use which option?
On command line, I have tried both set and setenv but couldn't able to set the environment variables. However with export it was working fine.
10 More Discussions You Might Find Interesting
1. 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
2. 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
3. UNIX for Dummies Questions & Answers
I never undestood exactly what's the difference between the SET and SETENV commands.
One sets variables visible to all users and the other (SETENV) only to the specific user environment ?
Thanks in advance,
BraZil - thE heLL iS HEre :mad: !!! (2 Replies)
Discussion started by: 435 Gavea
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
can anybody tell me what is the difference between set and export in unix.
-Ashish (1 Reply)
Discussion started by: shriashishpatil
1 Replies
5. 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
6. Shell Programming and Scripting
what is the difference in usage of set, export, typeset while declaring a value to a variable
can any one help
thanks (0 Replies)
Discussion started by: trichyselva
0 Replies
7. UNIX for Dummies Questions & Answers
I thought that set and setenv was easy enough to understand until I started experimenting.
I noticed the same problem in a previous thread, so I will use it as an example.
set command gave the following output:
argv ()
cwd /homes/e/ee325328/assignment.2
home /homes/e/ee325328
path ( a... (2 Replies)
Discussion started by: benwj
2 Replies
8. Shell Programming and Scripting
Hi All,
I use "export DISPLAY=same_host:0.0" to set my export DISPLAY and it is working fine for me..
Problem here is I have developed a script for which i should run export DISPLAY prior to running my script....
so my script should check whether export DISPLAY is set or not.. if... (6 Replies)
Discussion started by: smarty86
6 Replies
9. UNIX for Advanced & Expert Users
Does know where I can find what ALL of the set options do in vi? I can't find it anywhere in vi's man pages or help files. I know about :set all but a lot of the options I have no clue what they do. (3 Replies)
Discussion started by: cokedude
3 Replies
10. Solaris
Hi
I'm trying to understand variable scopes in solaris10.
It is said that to display env variables we use 3 commands :
- env
- set
- export
What is the difference between them ?
thx for help.
---------- Post updated at 11:00 AM ---------- Previous update was at 10:50 AM ----------
... (2 Replies)
Discussion started by: presul
2 Replies
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.10 31 Mar 2002 setenv(3C)