Monday, May 09, 2005

The "environment" and the "export"

Here we’ll discuss bout the environment. Why do we need to set up an environment? Why do we need to export? Etc.
Well..when we export a variable then it got enlisted in the environment.lets try it…
$ set
HOME=/data9/home/hpqar1
HZ=100
IFS=

LOGNAME=hpqar1
MAIL=/usr/mail/hpqar1
.
[heavily edited]
.

_INIT_UTS_VERSION=Generic_117350-18
$

it’s the result b4 exporting a variable.

N see the result after exporting a variable named “name”
$ name=hasim
$ export name
$ set
HOME=/data9/home/hpqar1
HZ=100
IFS=

LOGNAME=hpqar1
MAIL=/usr/mail/hpqar1
.
[heavily edited]
.

_INIT_UTS_VERSION=Generic_117350-18
name=hasim
$
One thing to keep in mind that the new exported variable will lasts till duration of the shell. Why we need to export? Lets say we want to take some of our executable files to work fine from a user created directory named shellscript for this session.bcz for others they may be of no use. Then we will export as..

$PATH=/somedir/somesubdir/shellscript
But here in this case all executable will look for the specified path above only. Be aware of this thing.
So wat we have got is that environment is just a shared pool of information to the shell to have better control over things.

Labels:

0 Comments:

Post a Comment

<< Home