comma
brace expansion and arithmetic separator in shell
TLDR
Brace expansion with sequence
SYNOPSIS
{item1,item2,...}
DESCRIPTION
The comma has several uses in shell scripting:
Brace expansion: {a,b,c} expands to a b c. Combined with text: file{1,2,3}.txt becomes file1.txt file2.txt file3.txt. Can be nested: {a,b{1,2}} expands to a b1 b2.
Arithmetic comma operator: In ((...)), comma separates expressions evaluated left to right, returning the rightmost value.
For loop multiple expressions: In C-style for loops, comma separates initialization and increment expressions.
Parameter expansion (bash 4+): ${var,,} lowercases, ${var,} lowercases first char.
CAVEATS
Brace expansion happens before variable expansion. {$a,$b} doesn't expand variables first.
No spaces around comma in brace expansion: {a, b} won't expand.
Brace expansion is a bash/zsh feature, not POSIX sh.
The comma operator in ((...)) is rarely needed; semicolons often suffice.
