The meaning of the-Z to-D in the conditional judgment in the shell
[-A file] if FILE existence is true.
[-B-file] True if file exists and is a block-specific file.
[-C file] is true if file exists and is a word special file.
[-D file] is true if
The meaning of the-Z to-D in the conditional judgment in the shell
Copyright Notice: This article original articles for bloggers, repost please indicate the source. If in doubt, please contact me. I'll be appreciated.
If condition judgment for Linuxshell scriptsIF condition judgment1. Basic Syntax:If [command]; thenStatements that meet this conditionFi2. Extended Syntax:If [command]; thenStatements that meet this conditionElif [command]; thenStatements that meet
If condition judgment of Linux shell script, linuxshellIF condition judgment1. Basic Syntax:If [command]; thenStatements that meet this conditionFi
2. Extended Syntax:
If [command]; then
Statements that meet this condition
Elif [command];
Comparison and judgment are the elements of program flow control. This article summarizes shell comparison and judgment statements for ease of searching and using. 1. Important comparison Operators Greater than:-GT Less than:-lt Greater than
Arithmetic operations are undoubtedly very important in shell scripting programming;The command to perform an integer arithmetic operation in bash is let, which has the syntax format:Let Arg ...Arg is a complete arithmetic expression consisting of a
#!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter Judging $ Whether the MyPath exists and has enforceable permissions if [!-X ' $myPath]; then mkdir "$myPath" fi #这里的-D parameter to determine if
1. Shell to determine the file, whether the directory exists or has permissions2. #!/bin/sh3.4. Mypath= "/var/log/httpd/"5. myfile= "/var/log/httpd/access.log"6.7. # the-x parameter here determines whether the $mypath exists and has executable
Http://man.linuxde.net/testHttp://blog.chinaunix.net/uid-24780853-id-2578709.html[email protected] ~]# man testtest (1) User Commands Test (1) NAME test - Check file types and compare Valuessynopsis Test EXPRESSION t EST [EXPRESSION] []
Startup script start.sh This script is used to start the project, log logs and PID#!/bin/shprg=" $" #$ A represents the current startup script # Get the true path of the file while[-H"$PRG"]; Dols= ' Ls-ld"$PRG"' link= ' Expr"$ls": ' .*-> \ (. *\) $"
Function of the test Command: check files and compare values. 1. determine the expression iftest (the expression is true) iftest! (Expression is false) test expression 1-a expression 2 both are true test expression 1-o expression 2 two expressions
first, the numerical judgmentInt1-eq INT2 INT1 and INT2 two number equal true Int1-ne INT2 INT1 and INT2 two number of true int1-gt INT2 INT1 greater than INT1 for true int1-g e INT2 INT1 greater than or equal to INT2 trueInt1-lt INT2 INT1 Less than
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 &
Test switch and special parameters in Shell script, shell script1. Test Switch
The following table lists the meanings of the test commands and whether they can be used in test commands, bash, and ksh.
Switch
Test
Bash
Ksh
Micro Blog: http://xsboke.blog.51cto.com
Xiaosheng Q: 1770058260
------- Thank you for your reference. If you have any questions, please contact us.
MySQL
# Mysql Data Import and Export # The queried data is exported to the CSV file select *
If condition judgment1. Basic syntax:if [command]; ThenStatements that meet the criteria for executionFi2. Extended syntax:if [command];thenStatements that meet the criteria for executionelif [Command];thenStatements that meet the criteria for
Shell Determines whether a file exists1. Shell to determine the file, whether the directory exists or has permissions2. #!/bin/sh3.4. Mypath= "/var/log/httpd/"5. Myfile= "/var/log/httpd/access.log"6.7. # the-x parameter here determines whether the
Conditional judgment is the basis for a program to gain intelligence, while the Bourne shell script simulates conditional expressions in most programming languages by command.The control structures supported in the shell are:(1) If then else fi(2)
Basic Format:Test expression
Expression is the expression constructed by the test command.Expression is any valid expression that can be understood by the test command. The simplified format is the most common format that readers may refer.Return
Fundamentals of the ten-year OPS series-LinuxZeng LinContact: [Email protected]Website: www.jplatformx.comCopyright: Please do not reprint the article without permission
first, use the IF statementThrough the shell, we can write a shell script
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.