Static languages: Compiled languages are converted into executable formats in advance
Strongly typed (variable)
Key words:
C C + + JAVA C #
Dynamic language: Interpreted language on the fly
Weak type
Edge Interpretation Side Execution
ASP. NET Shell PHP Python perl
Process oriented
Object oriented
variables: Memory space, naming
Variable type: Determine the storage format and length of the data in advance
character
value
Integral type
floating point type: 11,23
integral type: 8bit
0-255 Overflow--Buffer overflow
Logic:
Boolean type: 0,1
logical operations: with, or, non, XOR, or
1: True
0: Fake
1&0=0
0&0=0
1&1=1
non: Take counter
! true = False
! false = True
Shell: Weak type
Strong: Variables must be declared before they are used, or even initialized
Weak: variable time declaration, not even type-sensitive
Bash Variable type:
Environment variables
Local variables (local variables)
Positional variables
Special variables
Local Variables:
Set Varname=value: Scope entire bash process
Local Variables:
Local Varname=value: Scope is the current code snippet
Environment variables:Scope is the current shell process and its child processes
Export Varname=value
Export
The script starts a child shell process when it executes
Scripts that are started on the command line inherit the current shell environment variable:
Scripts that are automatically executed by the system (not command-line startup) require a self-defined environment variable:
Positional variables:
$1,$2,.....
Special variables:
$?: previous command execution status return value:
After the program executes, there may be two types of return values
Program execution Results
Program Status return codes (0-255)
0: Correct execution
1-255: Error execution. 1,2,127 System Reservation
Output redirection:
>
>>
2>
2>>
&>
/dev/null: Software device bit bucket data black hole
Bash
Reference variable:${varname} {} can sometimes be omitted
undo Variable:
Unset VARNAME
To view variables in the current shell:
Set
To view environment variables in the current shell:
Printenv
Env
Export
Special variables, positional variables cannot be viewed
Script: Command stack, according to the actual need to combine the command flow control mechanism to implement the source program
Shebang: Magic number
#!/bin/bash
#注释行, do not perform
Shell's basic concepts and variable types