Linux Environment Variables-basic

来源:互联网 发布:成发待遇知乎 编辑:程序博客网 时间:2024/04/30 11:41

1)Some examples of build-in shell variables:

PS1: defines the shell's command-line prompt.

HOME: defines the home directory for a user.

PATH: defines a list of directories to search through when looking for a command to execute.

 

2)Commands

/*list */

env:  list the current varues of all environment variables.

echo $variable_name : list a specific variable.

/*example */

-> echo $PS1
$(ppwd /l)/u@/h:/w>

/*Setting */

PATH=$PATH:$HOME/bin /*changing PATH variable to include personal directory. */

 

/*example */

code=$HOME/projects/src/ipudp

cd $code

/* Note: the scope(visibility) is limited to the current shell. */

/* use export to make the setting global. */

export code=$HOME/projects/src/ipudp

 

原创粉丝点击