Bash Environment Configuration
Profiles : divided by effective scope, two categories:
Global configuration file:/ETC/PROFILE,/ETC/PROFILE.D/*.SH,ETC/BASHRC
Personal configuration file: ~/.BASH_PROFILE,~/.BASHRC
Classification by function: two types:
profile class: Interactive login ( i.e. login or su-username directly via the terminal)
/etc/profile,/etc/profile.d/*.sh,~/.bash_profile
function: 1. Define environment variables, such as PATH,PS1 2. Run a command or script
BASHRC class: Non-interactive login (Command window open under graphical interface, execute script, su username)
/etc/bashrc,~/.bashrc
function: 1. Define command Aliases 2. Define Local variables
configuration file Action order:
Interactive login:/etc/profile,/etc/profile.d/*.sh->~/.bash_profile, ~/.BASHRC,/etc/bashrc< /c7>
non-interactive login: ~/.BASHRC---/ETC/BASHRC->/etc/profile.d/*.sh
How does the configuration file change?
Re-Login
Lets the shell process reread the specified configuration file, source or. This way, but there will be some side effects
Bash the variables in :
Type:
Environment variables: scope current shell process and its child processes
local variable: scope current shell process
Local variables: scoped only to a snippet of code in the current shell process (usually a function context)
Position variable: $ $, $
Special variables: $?
How variables are defined:
Bash built-in variables: can be called directly, built in a number of environment variables, such as Path
Custom variable: variable assignment: variable name = value
Bash Weak type:
When a variable stores data, it is written by default, and any variable can be directly referenced without being declared;
to define a local variable:
Name=value
View: Set
Define environment variables:
Export Name=value
Declare-x Name=value
View variables: env, printenv, export
undo variable: Unsetname
reference variable: ${name}, $name
Bash the reference symbol in:
"': strong references, variable substitution does not occur
"" : Weak references
``: Command Reference
This article is from the "naïve Little Comrade" blog, please be sure to keep this source http://dengxi.blog.51cto.com/4804263/1691234
Linux Learning Path 4-bash environment configuration