Shell after class summary |
High waves Archive: Learning Notes December 4, 2017 13:31:08 |
Shortcut keys: Ctrl + 1 title 1 Ctrl + 2 title 2 Ctrl + 3 title 3 Ctrl + 4 Example Ctrl + 5 Program Code Ctrl + 6 Body |
Format Description: Blue font: Comments Yellow background: Important Green background: note |
- Directory
1.1 Mesh record I
Chapter I. 1
1.1.1 Built-in commands and General command built-in commands are highly efficient. 1
1.1.2 Yum is python written by default system Python is 2.7. If the direct download of the 3.0 overlay will cause Yum to be unavailable. 1
1.1.3 script in different languages of the shell. 1
1.1.4 four ways to execute a shell script. 2
1.1.5 SH Execute when you create a new shell window (create a new process) execute the contents of the file 2
1.1.6 environment variables. 2
1.1.7 defines 5 files for an environment variable. 3
The order of 1.1.8 environment variables is. 4
1.1.9 system where so many variables are stored. Scattered in 4 system files and/ETC/PROFILE.D directories below 5
Chapter I.
- Built-in commands and General command built-in commands are highly efficient.
Built-in commands, the system starts to load. Read from memory, fast, high efficiency
General commands require reading from the hard disk and are inefficient.
- Yum is python written by default system Python is 2.7. If you download the 3.0 overlay directly, Yum will not work.
Need to replace the default path installation
[email protected] ~]# which Yum
/usr/bin/yum
[Email protected] ~]# File/usr/bin/yum
/usr/bin/yum: Python script, ASCII text executable
- Scripting scripts in different languages of the shell.
- Four ways to execute a shell script.
The first type:
SH oldboyedu.sh
Bash oldboyedu.sh
The second type:
chmod +x./oldboyedu.sh
./oldboyedu.sh
The third method of execution:
Cat Oldboyedu.sh|bash
The fourth type:
SOURCE Source is a command that executes a file in the current shell
. Click the script name.
- SH Executes a new shell window (creates a new process) executes the contents of the file
- Environment variables.
Environment variables are generally called global variables.
General variables are also called local variables.
Environment variable: The current shell and all child shell windows take effect globally.
If it takes effect in the newly opened shell, it needs to be written to the configuration file.
Define environment with export
[Email protected] scripts]# Aa=oldboy
[Email protected] scripts]# echo $AA
Oldboy
[Email protected] scripts]# vim tt.sh
Echo $AA
Echo $BB
[Email protected] scripts]# sh tt.sh
[Email protected] scripts]# source tt.sh
Oldboy
Source load the script into the current script to run .
- 5 files that define an environment variable.
/etc/profile
/etc/bashrc
~/.bashrc
~/.bash_profile
/etc/profile.d/
- The order of the environment variables is.
/etc/profile===>~/.bash_profile====>~/.bashrc=====>/etc/bashrc
- The system is where so many variables are stored. Scattered under 4 system files and/ETC/PROFILE.D directories
System variables are placed in many places
There are four global variables in the location file.
Shell after class summary