Blog 已遷移 http://steventtud.com，logdown 版本不再更新，麻煩大家前往新網站觀看^^

## EDX Linux Foundation Ch 9：User Environment Section 2 Environment Variables

### Environment Variables

Environment variables are simply named quantities that have specific values and are understood by the command shell, such as bash. Some of these are pre-set (built-in) by the system, and others are set by the user either at the command line or within startup and other scripts.

#### env和export

env是environment的簡寫，可以列出來所有的環境變數。

#### 環境變數與自定變數

By default, variables created within a script are only available to the current shell; child processes (sub-shells) will not have access to values that have been set or modified. Allowing child processes to see the values, requires use of the export command.

### Setting Environment Variables

#### Export a new variable value

export除了可以查看以外還可以用來設定環境變數

Type source ~/.bashrc or just . ~/.bashrc (dot ~/.bashrc); or just start a new shell by typing bash

### The HOME Variable

HOME is an environment variable that represents the home (or login) directory of the user.

### The PS1 Variable

Prompt Statement (PS) is used to customize your prompt string in your terminal windows to display the information you want.

### The SHELL Variable

The environment variable SHELL points to the user's default command shell and contains the full pathname to the shell: