Test statement format: [conditional expression] Subdivision Test statements are: File test, logic test, integer value comparison, String comparison------------------------------------------------------------------------------------file test: [operator file or directory name]- D test whether the directory-e test file or directory is operating-F to determine whether the current user has permission to read-W test whether the present user has permission to write to-X tests whether the current user has permission to execute the [-d/etc/fstab] test for the directory echo $? View return value 0 Proof of the previous command success Logic test: [expression 1] operator [expression 2]&& logical with, "and" meaning on an expression executed after successful execution | | Logical OR, "or" means the execution of an expression fails after execution! logical no [-d/etc/fstab] && echo yes | | Echo no test is a catalog-enhanced integer value comparison: [Integer 1 operator integer 2]-EQ determines whether the-ne judgment is not equal to whether the-GT judgment is greater than the-LT judgment is greater than the-le judgment whether it is equal to or less than the-ge judgment is greater than or equal to the string comparison: [string 1 operator character String 2]= Compare string content is the same! = Compare string contents Whether or not the string contents are blank
Shell Test Statements