Every process has an _environment_ associated with it. An
environment is a collection of _environment variables_. A variable
is a changeable value with a fixed name. For example, the name EMAIL
could refer to the value joe@nowhere.com. The value can vary; EMAIL
could also refer to jane@somewhere.com.
Because your shell is a process like any other, it has an
environment. You can view your shell’s environment by entering the
printenv command. Figure 6.1 has some sample output from printenv.
On your system, the output will be different but similar.
[Illustration: Figure 6.1: Sample printenv output]
Environment variables are one way to configure the system. For
example, the EDITOR variable lets you select your preferred editor
for posting news, writing e-mail, and so on.
Setting environment variables is simple. For practice, try
customizing your shell’s prompt and your text file viewer with
environment variables. First, let’s get a bit of background
information.
man less
This command lets you view the online manual for the less command.
In order to show you the text one screenful at a time, man invokes a
pager that shows you a new page of text each time you press the
space bar. By default, it uses the pager called more.
Go ahead and glance over the man page for less, which is an enhanced
pager. Scroll to a new page by pressing space; press q to quit. more
will also quit automatically when you reach the end of the man page.
export PAGER=less
After reading about the advantages of less, you might want to use it
to read man pages. To do this, you set the environment variable
PAGER.
The command to set an environment variable within bash always has
this format: