-b file If it exists and is a block special file, True-c file If it exists and is a character special file, True-d file if it exists and is a directory, true-e file if it exists, it is true-f file If it exists and is a rule file, True-if the file exists and the value of the Sgid bit is set, it is true-h file is true if it exists and is a compliant link-K file if files exist and are set"Sticky"the value of the bit-p file If it exists and is a named pipe, True-r file is true if it exists and is readable-s file is true if it exists and its size is greater than 0-if the file exists and the SUID bit is set, it is true-W file is true if it exists and is writable-x file is true if it exists and can be executed-o file is true if it exists and is owned by a valid user ID-ZstringTrue if string length is 0-NstringTrue if string length is not 0 string1=string2 True if two strings are equal string1!=string2 True if two strings are not equal int1-eq int2 if Int1 equals Int2, then true int1-NE int2 If int1 is not equal to Int2, then true int1-LT Int2 If Int1 is less than Int2, it is true int1-le int2 true if int1 is less than or equal to Int2 int1-GT Int2 If Int1 is greater than Int2, it is true int1-GE Int2 True if int1 is greater than or equal to Int2!If expr is false, the compound expression is true. Expr can be any valid test expression Expr1-a expr2 if Expr1 and Expr2 are true, the whole is true expr1-o expr2 if Expr1 and expr2 have a true integer for true special variable $0the name of the command being executed. For shell scripts, this is the path to the activated command $n the variable corresponds to the parameter that was taken when the script was activated. n is a positive integer that corresponds to the position of the parameter ($1,$2...) $# provides the parameter number of the script* All these parameters are quoted in double quotes. If a script receives two parameters, $* equals $1$2[email protected] All of these parameters are quoted in double quotes respectively. If a script receives two parameters, [email protected] is equivalent to $1$2$?the exit state after the execution of the previous command $$ the current shell's process number. For shell scripts, this is the process at which it is executing id$! The process number of the previous background command
Shell Condition judgment Parameters