Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
syntax:arith_expr [2012/11/02 18:00]
techlivezheng [Arithmetic expressions and return codes] Fix a mistake
syntax:arith_expr [2017/02/11 14:22] (current)
fgrose [Table] meaning of ternary operator
Line 15: Line 15:
 These expressions are evaluated following some rules described below. The operators and rules of arithmetic expressions are mainly derived from the C programming language. These expressions are evaluated following some rules described below. The operators and rules of arithmetic expressions are mainly derived from the C programming language.
  
-This article describes the theory of the used syntax and the behaviour. To get practical examples without big explanations,​ see [[http://​wooledge.org/​mywiki/ArithmeticExpression ​the article ​on Greg's wiki]].+This article describes the theory of the used syntax and the behaviour. To get practical examples without big explanations,​ see [[http://mywiki.wooledge.org/​BashGuide/CompoundCommands#​Arithmetic_Evaluation ​this page on Greg's wiki]].
  
 ===== Constants ===== ===== Constants =====
Line 164: Line 164:
 ==== Misc ==== ==== Misc ====
  
-^Operator^Description^ +^ Operator ​                     ^ Description ​                                                                          ​
-|''​id++''​|**post-increment** of the variable ''​id''​ (not required by POSIX(r))| +| ''​id++'' ​                     | **post-increment** of the variable ''​id''​ (not required by POSIX(r)) ​                 
-|''​id<​nowiki>​--</​nowiki>​''​|**post-decrement** of the variable ''​id''​ (not required by POSIX(r))| +| ''​id%%--%%'' ​                 | **post-decrement** of the variable ''​id''​ (not required by POSIX(r)) ​                 
-|''​++id''​|**pre-increment** of the variable ''​id''​ (not required by POSIX(r))| +| ''​++id'' ​                     | **pre-increment** of the variable ''​id''​ (not required by POSIX(r)) ​                  ​
-|''​<​nowiki>​--</​nowiki>​id''​|**pre-decrement** of the variable ''​id''​ (not required by POSIX(r))| +| ''​%%--%%id'' ​                 | **pre-decrement** of the variable ''​id''​ (not required by POSIX(r)) ​                  ​
-|''​+''​|unary plus| +| ''​+'' ​                        ​| unary plus                                                                            
-|''​-''​|unary minus| +| ''​-'' ​                        ​| unary minus                                                                           ​
-|''<​EXPR>​ ? <​EXPR>​ : <​EXPR>''​|conditional (ternary) operator| +| ''<​EXPR>​ ? <​EXPR>​ : <​EXPR>'' ​ | conditional (ternary) operator ​\\ <​condition>​ ? <​result-if-true>​ : <​result-if-false>  ​
-|''<​EXPR>​ , <​EXPR>''​|expression list| +| ''<​EXPR>​ , <​EXPR>'' ​          ​| expression list                                                                       ​
-|''​( <​EXPR>​ )''​|subexpression (to force precedence)|+| ''​( <​EXPR>​ )'' ​               | subexpression (to force precedence) ​                                                  ​|
  
  
  • syntax/arith_expr.1351879220.txt
  • Last modified: 2012/11/02 18:00
  • by techlivezheng