1. First introduce a test method that is the same as testing [expression] (Always note that there are spaces before and after expression, there will be an error if there are no spaces)
This test method is often used as an if condition.
/home/www This file name exists,/home/kkk This file name does not exist.
2. String Logic Test
[-Z "string1"] string string1 is empty, NULL returns True
[-N "string1"] string string1 is empty, returns true for non-null
3. Digital Logic Test
["Num1"-eq "num2"] num1 is equal to num2, yes true
["Num1"-lt "num2"] num1 is less than num2, yes true
["Num1"-GT "num2"] num1 is greater than num2, yes true
["Num1"-ne "num2"] num1 is not equal to num2, yes true
["Num1"-le "num2"] num1 is less than or equal to num2, yes true
["Num1"-ge "num2"] num1 is greater than or equal to num2, yes true
True in Linux is 0
Logical test of Linux basic commands two