Unset PS1

The .environment variable (the last line ot the output ot env shown earlier) holds the lull path of the last command executed within the shell — in this case, that of the env command you just ran.

To see the last few lines of output of a command you can "pipe" it to the tail com-v '3 . i-.-.,". \s .'..w-j mand. So to see the last few lines of the output of env, you can type env | tail. What is happening here is that the output of the env command is being passed as input to the tail command (which just displays the last few lines of whatever it receives). You can read more on connecting commands by pipes later in the chapter.

Environment variables can be set in a number of places:

■ System-wide configuration files such as those located in /etc/profile, /etc/ profile.local, and the directory /etc/profile.d on a Linux system. These are system-wide files that are executed to help initialize your working environment each time you log in.

■ System-wide configuration files such as /etc/bashrc. These are typically executed by a user's personalized bash configuration file each time that you start a new shell and set system-wide shell configuration variables.

■ User-specific configuration files such as .bashrc that are read each time you start a new shell.

■ Within shell scripts for use within those scripts or to be exported back to the command-line environment.

■ From the command line as you saw in the example, or within shell functions executed by the shell.

On occasion, you install some nonstandard software that places its executable files in a special directory that is not in a normal user's path. To run the program from the command line without typing the full path to the executable, you want to add that special directory to your PATH variable. For example, when you install an unusual package called frobulator, its executable file frobulate is installed at /usr/frobulator/bin/frobulate. If you were to type frobulate at the prompt, you would see the error message bash: frobulate: command not found. But if you do the following:

Was this article helpful?

0 0

Post a comment