1. For and if commands containing [] must be separated by spaces.
2. Calculation and Assignment Methods
Var = 1 (Note: Bash/pdksh cannot leave spaces on both sides of the equal sign)
First: (VAR ++ ))
Type 2: var =$ ($ var + 1 ))
3. Judgment conditions:
[-F "somefile"]: determines whether it is a file.
[-X "/bin/ls"]: determines whether/bin/ls exists and has the executable permission.
[-N "$ Var"]: determines whether the $ var variable has a value.
["$ A" = "$ B"]: determines whether $ A and $ B are equal.
Int1-EQ int2 | returns true if int1 is equal to int2
Int1-ge int2 | returns true if int1 is greater than/equal to int2
Int1-Le int2 | returns true if int1 is smaller than/equal to int2
Int1-GT int2 | returns true if int1 is greater than int2
Int1-ne int2 | returns true if int1 is not equal to int2
If [$ res = "Y"-o $ res = "Y"] Where-O or,-A and
4. Common commands
4-1 grep query Filtering
4-2 awk text operation tool
Variable name meaning
Number of argc command line Variables
Argv command line meta Array
Filename current input file name
Number of records in the current FNR File
The input field delimiter of FS. The default Delimiter is a space.
RS input record delimiter
Number of domains in the current NF record
No. of NR records so far
OFS output domain Separator
ORS output record Separator
Root # ll | awk-F "" '{print NR, NF, $8}' are separated by a space and only 8th columns are displayed.
The output port 2001Program: Netstat-tunlp | grep 2001 | awk-F "'{print $7}' | awk-F"/"'{print $2 }'