Linux conditional test statement and if statement

Conditional test statement

And: &&——A&&B——B will be executed only if A succeeds.
awk'{print $4}' Only column 4 will be kept
or:||——A||B——A failed, then B will be executed
:!—— The judgment result is reversed
$VSER: The variable that saves the current user name

Integer comparison operators

-eq Is it equal to
-born Is not equal to
-gt Is greater than
-lt Is it less than
-the Is it equal to or less than
-give Is greater than or equal to

String comparison operators

= Compare whether the string content is the same
!= Compare whether the string content is different
-with Determine whether the string content is empty
-with Determine whether the variable is used

if statement

if: conditional test operation
the: command sequence
fi: end
vim host.sh——host: test whether the host is online
1, ping -c 4 i 0.3 -w 4 $1 &> /dev/null
[1] -c 4: try The number of times
[2] i 0.3: each data packet sending interval 0.3: interval time
[3]-w 4: sending timeout period
[4] &: case insensitive
[5]>: output redirection
[6]/dev /null: Linux black hole file
read: able to read the information entered by the user
-p: display certain user information to the user

Guess you like

Origin blog.csdn.net/A147254/article/details/108758591