How to build a conditional assignment in bash?
If you want a way to define defaults in a shell script, use code like this:
: ${VAR:="default"}
Yes, the line begins with ':'. I use this in shell scripts so I can override variables in ENV, or use the default.
This is related because this is my most common use case for that kind of logic. ;]
As per Jonathan's comment:
variable=$(( 1 == 1 ? 1 : 0 ))
EDIT:
I revised the original answer which just echo
'd the value of the condition operator, it didn't actually show any assignment.