SHELL script strategy (Study Notes) -- 1.7 expr command full solution, -- 1.7 expr
The expr command can be used to perform numeric operations, numeric or string comparison, string matching, string extraction, and string length calculation. It also
The expr command is a manual command line counter used to evaluate the value of expression variables in Unix/Linux. It is generally used as an integer or a string.-Format:Expr expression (the command reads the expression parameter, computes its
I really don't know how to write this article name about trap and expr in shell, so I just wrote such a strange name. It is about trap and expr. Trap and expr are two commands in shell, which should be familiar to everyone, that is, the four
Expr Command
Use
Evaluate the value of an expression variable.
Grammar
Expr Expression
Description
The expr command reads the expression parameter, evaluates its value, and writes the result to the standard output.
You must apply the following
1. expr computes the integer variable valueS= ' Expr 2 + 3 'The arithmetic symbol and the parameter must have the space separate;2. Let command let s= (2+3) echo $s 3, for statement
For variable in list
Shell programming control structure: expr, let, for, while, until, shift, if, case, break, continue, function, select
1. expr calculates the integer variable value
S = 'expr 2 + 3'
The operator numbers and parameters must be separated by spaces;
2.
Method of applying Lex and YACC (IV). Application of syntax tree
Papaya 20070515
I. Sequencing
No matter what language, the syntax structure is always the same. You can imagine that any program can be interpreted as a syntax.The essence of the
Expr can do the following:Logical operationsArg1 | Arg2 logic or operation, true return arg1, otherwise return arg2 (null or to determine the true and false parameters, there is a short-circuit function)Arg1 & arg2 Logic and operation, true return
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.