Welcome back. In this series of lessons,
we'll discuss environment variables.
These are mechanism in
program and program libraries for preserving
values or information that
lasts over several runs of a program,
yet are easily changed by the user.
Lets get started. Environment Variables
provide a mechanism
for preserving values or
information that lasts over several runs of the program.
But also allowing it to be easily changed.
You don't have to go edit the file.
They're very widely used.
In Windows, this is the equivalent of the registry.
But in Linux and similar systems,
it's an actual variable stored
in the memory of the command interpreter.
These are typically under the control of the user,
that is you can change them, their values.
Programs use them, libraries use them,
and other parts of the system use them.
Home and user identify
the user and the home directory for example.
Editor, pager, and so forth all
indicate programs that should be
run when another program
wants for example to invoke an editor.
It'll look at the editor environment
variable to see which one you prefer.
When the command interpreter goes looking for a program,
it will look down the directories
listed in the path environment variable.
We'll get to what IFS means in a minute.
But basically it separates
words and we'll explain that in a couple of minutes.
Then you've got others that involve
the time zone where to look for
manual pages, what locale basically,
what language and cultural symbols
you're using for dollar and things like that.
In general, they have
a name followed by a value separated by an equal sign.
When the command interpreter starts up or you type that,
it reads the name and reads the value and then stores
the value as under the name.
Now in some command interpreters notably bash
which is a very widely used command interpreter in Linux.
You can do functions as well.
The format of the value here is specialized.
It has to begin with an open and close parentheses,
and then the rest of
the value has to be enclosed in curly braces,
which contains really the function body.