Commonly used condition judgment in linuxShell

Source: Internet
Author: User
Commonly used condition judgment in linuxShell-bfile if the file exists and is a special block file, it is true-cfile if the file exists and is a special character file, true-dfile if the file exists and is a directory, it is true-e... information & nbsp; | & nbsp common condition judgment in linux Shell-B file if the file exists and is a special file, true-c file if the file exists and is a special character file, true-d file if the file exists and is a directory, true-e file if the file exists, true-f file if the file exists and is a rule file, true-g file if the file exists and the SGID bit value is set, true-h file. if the file exists and is a conforming link, true-k file if the file exists and the "sticky" bit value is set-p file if the file exists and is a named pipe, true-r file if the file exists and is readable, true-s file: If the file exists and its size is greater than zero, it is true-u fi. Le if the file exists and the SUID bit is set, true-w file if the file exists and can be written, true-x file if the file exists and can be executed, true-o file if the file exists and is owned by the valid user ID, true-z string if the string length is 0, true-n string if the string length is not 0, it is true string1 = string2 if the two strings are equal, it is true string1! = String2 if the two strings are not equal, true int1-eq int2 if int1 is equal to int2, true int1-ne int2 if int1 is not equal to int2, true int1-lt int2 if int1 is smaller than int2, true int1-le int2 if int1 is smaller than or equal to int2, true int1-gt int2 if int1 is greater than int2, true int1-ge int2 if int1 is greater than or equal to int2, true! If expr is false, the composite expression is true. Expr can be any valid test expression expr1-a expr2 if both expr1 and expr2 are true, the entire formula is true expr1-o expr2 if expr1 and expr2 are true, the entire formula is true. the special variable $0 is name of the executed command. For shell scripts, this is the path of the activated command $ n. This variable corresponds to the parameters included when the script is activated. N is a positive integer corresponding to the parameter location ($1, $2 ...) $ # Provide the script parameter number $ * all these parameters are enclosed by double quotation marks. If a script receives two parameters, $ * equals to $1 $2 $ @. all these parameters are enclosed in double quotation marks. If a script receives two parameters, $ @ is equivalent to $1 $2 $? Exit status after the previous command is executed $ process number of the current shell. For a shell script, this is the ID of the process in progress $! Process Number of the previous background command
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.