05-20-2010
How to make Environment Variable Permanent ??
How can i set a environment variable in unix shell ?? I can set it using setenv or export but when i close & open the terminal again i couldn't see that environment variable, how can i make that change permanent ??
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
ulimit -a gives the following output:$ulimit -a
time(seconds) unlimited
file(blocks) 2097152
data(kbytes) 131072
stack(kbytes) 16384
memory(kbytes) unlimited
coredump(blocks) 32768
nofiles(descriptors) 400
vmemory(kbytes) 147456
Abot output... (3 Replies)
Discussion started by: nervous
3 Replies
2. Solaris
how do I make sure that the entry in the routing table on Solaris 8 stay permanent after rebooting the server.
For example
route add 172.20.1.60 -netmask 255.255.255.0 172.20.255.253
Each time the server reboots the entry disappears when using the command netstat -nr (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies
3. Solaris
Hi
If suppose there is a MAC address of NIC port. I have change the MAC address through following command
# ifconfig hme0 ether a:0:30:f0.ad:51
The change MAC address will be there till reboot.
Now I would like to know how to make the change MAC address permanent. I believe that... (1 Reply)
Discussion started by: amity
1 Replies
4. UNIX for Advanced & Expert Users
Is there anyway in which i can set a permanent global variable in unix, which when initialised with a value and modified during any shell script, would retain its value even if i logout and login
I dont know whether i am being able to express my need clearly but basically what i want is a... (3 Replies)
Discussion started by: arindamlive
3 Replies
5. Solaris
Greetings,
I am using solaris10 x86 OS. I configured IP address using the command.
>ifconfig e1000g0 plumb
>ifconfig e1000g0 200.200.0.1 up
How to make this configured IP as permanent.. to solaris os. (2 Replies)
Discussion started by: bhargav90
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I made following configuration to create user directory:
# authconfig --enablemkhomedir --update
But the directory is created as permission 755, I'd like to modify the script to change directory access permission to 700, where is the script which copies /etc/skel to /home... (0 Replies)
Discussion started by: hce
0 Replies
7. UNIX for Dummies Questions & Answers
I know that I can do this in bash
ver=${VERSION:-$DEFVERSION}
so ver is $VERSION if it's set but $DEFVERSION if $VERSION isn't set
I want to do the same thing as a macro in a Makefile and can't get it to work - maybe something like...
VER=$(shell ${$(VERSION):-$(DEFVERSION)})
Any help... (1 Reply)
Discussion started by: JerryHone
1 Replies
8. Shell Programming and Scripting
Hi,
I am writing a shell script where I want that # should be added in all those lines as the first character where the pattern matches.
file has lot of functions defined
a.sh
#!/bin/bash
fn a {
beautiful evening
sunny day
}
fn b {
}
fn c {
hello world .its a beautiful day
... (12 Replies)
Discussion started by: ashima jain
12 Replies
9. Shell Programming and Scripting
We are using csh on our AIX platform, if we have to export/set a specific environment variable we use setenv command but its only valid till session.
How do we set that variable permanent in our csh AIX? Do we put it in userprofile file or something else? (1 Reply)
Discussion started by: aixusrsys
1 Replies
10. AIX
Hello,
I'm able to mount NFSv3 shares permanently (/etc/filesystems) via smitty nfs.
/>lsfs -a
Name Nodename Mount Pt VFS Size Options Auto Accounting
/dev/hd4 -- / jfs2 2097152 -- yes no
/dev/hd1 -- ... (5 Replies)
Discussion started by: System Admin 77
5 Replies
LEARN ABOUT FREEBSD
unsetenv
GETENV(3) BSD Library Functions Manual GETENV(3)
NAME
getenv, putenv, setenv, unsetenv -- environment variable functions
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
char *
getenv(const char *name);
int
setenv(const char *name, const char *value, int overwrite);
int
putenv(char *string);
int
unsetenv(const char *name);
DESCRIPTION
These functions set, unset and fetch environment variables from the host environment list.
The getenv() function obtains the current value of the environment variable, name. The application should not modify the string pointed to
by the getenv() function.
The setenv() function inserts or resets the environment variable name in the current environment list. If the variable name does not exist
in the list, it is inserted with the given value. If the variable does exist, the argument overwrite is tested; if overwrite is zero, the
variable is not reset, otherwise it is reset to the given value.
The putenv() function takes an argument of the form ``name=value'' and puts it directly into the current environment, so altering the argu-
ment shall change the environment. If the variable name does not exist in the list, it is inserted with the given value. If the variable
name does exist, it is reset to the given value.
The unsetenv() function deletes all instances of the variable name pointed to by name from the list.
If corruption (e.g., a name without a value) is detected while making a copy of environ for internal usage, then setenv(), unsetenv() and
putenv() will output a warning to stderr about the issue, drop the corrupt entry and complete the task without error.
RETURN VALUES
The getenv() function returns the value of the environment variable as a NUL-terminated string. If the variable name is not in the current
environment, NULL is returned.
The setenv(), putenv(), and unsetenv() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable
errno is set to indicate the error.
ERRORS
[EINVAL] The function getenv(), setenv() or unsetenv() failed because the name is a NULL pointer, points to an empty string, or
points to a string containing an ``='' character.
The function putenv() failed because string is a NULL pointer, string is without an ``='' character or ``='' is the first
character in string. This does not follow the POSIX specification.
[ENOMEM] The function setenv(), unsetenv() or putenv() failed because they were unable to allocate memory for the environment.
SEE ALSO
csh(1), sh(1), execve(2), environ(7)
STANDARDS
The getenv() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The setenv(), putenv() and unsetenv() functions conforms to IEEE Std
1003.1-2001 (``POSIX.1'').
HISTORY
The functions setenv() and unsetenv() appeared in Version 7 AT&T UNIX. The putenv() function appeared in 4.3BSD-Reno.
Until FreeBSD 7.0, putenv() would make a copy of string and insert it into the environment using setenv(). This was changed to use string as
the memory location of the ``name=value'' pair to follow the POSIX specification.
BUGS
Successive calls to setenv() that assign a larger-sized value than any previous value to the same name will result in a memory leak. The
FreeBSD semantics for this function (namely, that the contents of value are copied and that old values remain accessible indefinitely) make
this bug unavoidable. Future versions may eliminate one or both of these semantic guarantees in order to fix the bug.
BSD
June 20, 2007 BSD