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 ----------
I understand this :
To list all shell vars with their current values perform set cmd.
# set
HOME=/root
HZ=
IFS=
LC_COLLATE=pl_PL.ISO8859-2
LC_CTYPE=pl_PL.ISO8859-2
LC_MESSAGES=C
LC_MONETARY=pl_PL.ISO8859-2
LC_NUMERIC=pl_PL.ISO8859-2
LC_TIME=pl_PL.ISO8859-2
LOCAL=local_variable
LOGNAME=root
MAIL=/var/mail/root
MAILCHECK=600
OPTIND=1
PATH=/usr/sbin:/usr/bin
PS1=#
PS2=>
REMOTE=remote_variable
SHELL=/sbin/sh
TERM=ansi
TZ=Poland
To make a value of variable known to a subshell export it using the export cmd.
# export
export LOGNAME
export PATH
export REMOTE
QUESTIONS
---------------
Now I understand the difference between set and export cmds but don't understand the meaning of env command ?
What does it mean to make a value of variable known to a sub-shell ?