# As I just mentioned, there are 2 types of variables floating # around in UNIX. The other are the «environment», a set of # variables passed around to each program. In a short while, we will # write a C program to look at them, so you see that they are not # the same as shell variables. # In any case, the program ‹env› prints all environment variables. # You can run it like this: echo '# looking for PATH in the environment' env | fgrep PATH # Shells typically make it possible to add their own variables into # the environment, and they make all environment variables available # as their own (via ‹$› expansion). echo '# doing echo $PATH' echo $PATH # Adding variables into the environment is done with ‹export›: echo echo '# setting VAR, echo-ing it and looking for it in env' VAR=17 echo $VAR env | fgrep VAR echo echo '# exporting VAR, echo-ing it and looking for it in env' export VAR echo $VAR env | fgrep VAR echo echo '# changing the value of VAR' VAR=13 echo $VAR env | fgrep VAR echo echo 'That said, let us go on to getenv.c'