Illustration: Figure 6.2: Changing the prompt

export NAME=value

export means to move the variable from the shell into the

environment. This means that programs other than the shell (for

instance, a file viewer) will be able to access it.

echo $PAGER

This is the easiest way to see the value of a variable. $PAGER tells

the shell to insert the value of the PAGER variable _before_

invoking the command. echo echoes back its argument: in this case,

it echoes the current PAGER value, less.

man more

Displays the more manual. This time, man should have invoked the

less pager.

less has lots of features that more lacks. For example, you can

scroll backward with the b key. You can also move up and down (even

sideways) with the arrow keys. less won’t exit when it reaches the

end of the man page; it will wait for you to press q.

You can try out some less-specific commands, like b, to verify that

they don’t work with more and that you are indeed using more.

unset PAGER

If you don’t want to specify a pager anymore, you can unset the

variable. man will then use more by default, just as it did before

you set the variable.

echo $PAGER

Because PAGER has been unset, echo won’t print anything.

PS1=hello:

Just for fun, change your shell prompt. $ should now change; see

Figure 6.2 for details.

export is not necessary, because you’re changing the shell’s own

behavior. There’s no reason to export the variable into the

environment for other programs to see. Technically, PS1 is a _shell

variable_ rather than an environment variable.

If you wanted to, you could export the shell variable, transforming

it into an environment variable. If you do this, programs you run

from the shell can see it.

Debian GNU/Linux : Guide to Installation and Usage · 第 96 / 193 题