Languages and Scripting
Showing results for 
Search instead for 
Did you mean: 

Envr variable and Shell Variable

Srinivas Manoj
Occasional Contributor

Envr variable and Shell Variable

Can anyone explain me in simple terms the difference between Environment and Shell Variables.
James R. Ferguson
Acclaimed Contributor

Re: Envr variable and Shell Variable


Environmental variables are inherited variables from a parent process. A variable that you declare (in a shell) and subsequently 'export' (or 'setenv' in a C-shell) becomes an environmental variable. As such, any child process created, inherits that variable.


Frequent Advisor

Re: Envr variable and Shell Variable

actually the environment variables determines the environment of your shell like your display console,path when you give the extrinsic commands,and all these are used for the system specific process(GLOBAL VARIABLES),

and the shell variables are just related to the shell itself which are used for the shell specific purpose(LOCAL VARIABLES)..

child shell inherits the environment variables from parent shell,if we want to inherit the shell variables also then we have to export that particular shell variable from parent shell...
Proud to be in HP IT Resource Center

Re: Envr variable and Shell Variable

environment variables as the name suggests , are there for the environment ie these are the variables which will be inherited by child processes , For eg if you invoke another shell by just doing ksh , the value of these variables will be inherited to the new shell

However, shell variables are local to that shell .if you open another shell these values will not get copied to that shell.