In Bash Manual, sec 6.5 Shell Arithmetic
expr1 , expr2 comma
What does the comma operator do?
expr2 arithmetic expressions?
, is a list operator.
The list of arithmetic expressions will be evaluated from left to right, the last expression result is the return value:
$ echo "$(( a=1, ++a, ++a ))" 3
, list operator was added in bash-2.04-devel (along with pre/post increment/decrement operators).
The comma operator is valid in bash (
LESS=+/'expr1 , expr2' man bash):
expr1 , expr2
And no other explanation of its use.
For that we have to read the "C Language" description (where all this arithmetic operators were born).
Example (as in the link above) (the second of which has the value 5):
$ echo "$(( (t=3, t+2) )) $t" 5 3
$ echo "$(( t=3, t+2 )) $t" 5 3
Yes each element separated by a comma may be an expression:
1313 expression: assignment-expression expression , assignment-expression
POSIX does not include a comma operator:
Table: Selected ISO C Standard Operators and Control Flow Keywords
Or just try:
$ dash -c 'echo $(( t=3,t+2 ))' dash: 1: arithmetic expression: expecting EOF: " t=3,t+2 " $ bash -c 'echo $(( t=3,t+2 ))' 5
As IBM confirm in its page for AIX and POSIX shell (emphasis mine):
All of the integral operators, other than ..., and comma (,), are supported.
But, also in AIX, IBM claim support for comma operator from the ksh93 shell at
More arithmetic operators are available, including the unary +, ++, --, and the ?: construct (for example, "x ? y : z"), as well as the , (comma) operator.
dash, ksh do not have a comma operator. ksh93 may have a comma operator. bash, zsh do have a comma operator.