arithmetic-operator
Bash ? arithmetic operator
Evaluates the condition, then only the selected branch; syntax includes both ? and :.
Formal Syntax & Structure
bash syntaxbash
$(( 8 > 3 ? 10 : 20 ))Return Value
integer
Evaluates the condition, then only the selected branch; syntax includes both ? and :.
Working Example
Example Snippetbash
printf '%s\n' "$(( 8 > 3 ? 10 : 20 ))"