Note content:
8.6 pipe symbol and job control
8.7/8.8 Shell Variables
8.9 environment variable configuration file
Note Date:2017.8.15
8.6 pipe symbol and job control
The pipe character can pass the output of a file to the following command:
So the pipe symbol is simply to put the previous command execution results to the following command execution.
Job Control:
CTRL + Z can temporarily stop the current command:
At this point , the Vim command was thrown backstage.
now if you want to continue with the VIM command, you need to use the FG command:
CTRL + Z can stop multiple commands:
Jobs can view the currently paused commands:
FG command plus ID Number can continue the specified command:
Because the first command was continued, two remaining commands were paused:
The FG command does not add the ID number, which is the default continuation of the last command:
The BG command can move a paused command to the background to run:
Add & symbol at the end of the command to throw a command into the background to execute:
When the command finishes running in the background, it displays the completion:
If opening a new terminal is not visible to another terminal in the background execution of the command:
8.7/8.8 Shell variables
We know PATH is the system built-in variables, as well as HOME,PWD,LOGNAME and Other variables, these variables are in the system configuration file rules, the env command can get to the system variables, the system variables are generally uppercase, the value of the variable can be a string or a number:
The Set command can also view variables, but not only the variables of the system, but also the user-defined variables , which only show system variables and custom variables before CentOS6, in CentOS7 There are many more Shell script related things:
User-defined variables:
user-defined variables can be represented in set :
You often use variables when writing shell scripts: variables can begin with a letter, an underscore, but not a number:
The value of a variable must be enclosed in single quotation marks when it has a special symbol:
echo $SSH _tty command to see which terminal is currently under:
The summation of variables:
The Bash command opens a child shell, which is equivalent to opening a terminal:
Global variables:
custom variables in the current terminal are not visible in the child shell because the defined variable is not a global variable, it is a local variable, and if you want to define a global variable you need to use the export command:
The global variable defined by export is down, that is, if the global variable defined in the child Shell is in the parent shell of the child shell is not visible on:
Global variables are also not visible in the other terminal:
To cancel a variable:
Unset the name of the variable followed by the command, you can cancel out the value of the variable:
8.9 environment variable configuration file
environment variable configuration file has two major categories, one is the system hierarchy dimension of the configuration file in the ETC directory, and the second is the user hierarchy dimension of the configuration file in the user's home directory.
the profile file is loaded when the user logs on to the
The BASHRC file is loaded into the user and system when some shell scripts are executed
system-level profile and BASHRC files generally do not move, if you want to modify the user level . Bashrc_profile and the . BASHRC file.
The. Bashrc_profile file will be called when the. bashrc fileis loaded, and the. BASHRC file will be called etc The BASHRC file under the directory .
The. Bashrc_loguot file is used to define what needs to be done when the user exits, and if you want to remove the history command when the user exits, you can write the command to delete the history command in the . Bashrc_loguot file.
The PS1 variable is defined in the bashrc file under the etc Directory:
When you log on to the system, a string of strings appears on the left, and the user name and host name of the currently logged on system have the current directory:
The PS1 variable is used to configure the contents of this string display:
the value of the PS1 variable can be custom modified, for example, I remove the square brackets:
For example, I put the uppercase W is changed to lowercase w, so the absolute path is displayed:
PS2 is used in a different environment, such as the command line of MySQL :
Extended
The difference between BASHRC and bash_profile :
http://ask.apelearn.com/question/7719
This article is from the "12831981" blog, please be sure to keep this source http://12841981.blog.51cto.com/12831981/1972601
Pipe and job control, shell variables, environment variable configuration