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 Both sides next revision
syntax:arith_expr [2012/11/02 17:51]
techlivezheng [Arithmetic expressions]
syntax:arith_expr [2012/11/02 18:00]
techlivezheng [Arithmetic expressions and return codes] Fix a mistake
Line 205: Line 205:
 Bash's overall language construct is based on exit codes or return codes of commands or functions to be executed. ''​if''​ statements, ''​while''​ loops, etc., they all take the return codes of commands as conditions. Bash's overall language construct is based on exit codes or return codes of commands or functions to be executed. ''​if''​ statements, ''​while''​ loops, etc., they all take the return codes of commands as conditions.
  
-Now the problem is: The return codes (0 means "​TRUE"​ or "​SUCCESS",​ not 0 means "​FALSE"​ or "​FAILURE"​) don't correspond to the meaning of the result of an arithmetic expression (0 means "TRUE", not 0 means "FALSE").+Now the problem is: The return codes (0 means "​TRUE"​ or "​SUCCESS",​ not 0 means "​FALSE"​ or "​FAILURE"​) don't correspond to the meaning of the result of an arithmetic expression (0 means "FALSE", not 0 means "TRUE").
  
 That's why all commands and keywords that do arithmetic operations attempt to **translate** the arithmetical meaning into an equivalent return code. This simply means: That's why all commands and keywords that do arithmetic operations attempt to **translate** the arithmetical meaning into an equivalent return code. This simply means:
  • syntax/arith_expr.txt
  • Last modified: 2017/02/11 14:22
  • by fgrose