Previously review:
File management, user management, rights Management, Bash's basic features
File Management: CP,MV,RM
User management:
Useradd,usermod,userdel,chfn,chsh,chage
Groupadd,groupmod,groupdel
Passwd,gpasswd,pwck
Id,finger,who,whoami,w
Su
Configuration file:/etc/passwd,/etc/shadow,/etc/group,/etc/gshadow
Rights Management:
Perm:mode (RWXRWXRWX), ownership
Chmod,chown,chgrp
-R,---Reference=rfile
File:666-umask
Dir:777-umask
Bash Basic Features:
Command line expansion: ~,{}
Command alias: Alias/unalias
Command history: Historical
Command and path completion: $PATH
glob:*,?, [],[^]
Shortcut key: Ctrl+{a,e,l,c,u,k}
Command hash:
Basic features of Bash (3)
1. Provides a programming environment
Program: Instruction + data
Program Programming Style:
Program: command-centric, data-serving instruction
Object type: Data-centric, instruction serves data
Shell program: Provides programming capabilities to interpret execution
How the program is executed:
Computers: Running binary directives
Programming Languages:
Low Level: Compilation
Senior:
Compiling: High-level language--compiler---Target code
C,c++
Explanation: High-level language--interpreter---Target code
Shell,python,perl
Program Programming:
Sequential execution
Loop execution
Select Execute
Shell programming: Over-Program, interpreting execution
The basic structure of the programming language:
Data storage: variables, arrays
An expression
Statement
Shell script: Text file
Shebang:
#!/bin/bash
#!/usr/bin/python
#!/usr/bin/perl
Magic Number: Magic Numbers
To run the script:
1. Give execution permission to specify file execution through a specific file path:./test.sh
2. Run the interpreter directly and run the script as a parameter of the Interpreter program: Bash test.sh
Variable:
Named memory space:
Data storage mode: ASCII
Characters: 110:24 bit
Value: 110:8 bit
Integral and floating-point types
Variable: Variable type
Role:
1. Data storage format
2. Participate in the operation
3. Range of data represented
Type:
Character
Value: Integer, Float, Boolean
Programming Languages:
Strong type: C
Weak type: Bash
All the data to be stored as characters
Floating-point numbers are not supported
Logical operation:
True,false
1,0
And:
1 && 1 = 1
1 && 0 = 0
0 && 0 = 0
0 && 1 = 0
Or:
1 | | 1 = 1
1 | | 0 = 1
0 | | 0 = 0
0 | | 1 = 1
Non -:
!0 = 1
!1 = 0
Short-circuit Operation:
And:
The first one is 0, and the result must be 0.
The first one is 1, the second must be involved in the operation
Or:
The first one is 1, and the result must be 1.
The first one is 0, the second must be involved in the operation
2.5-shell Programming Preliminary