Ternary Operator
In js:
FOO === 'foo' ? (BAR = 'bar1') : (BAR = 'bar2');
In bash:
[[ $FOO = foo ]] && BAR=bar1 || BAR=bar2
In js:
FOO === 'foo1' ? (BAR = 'bar1') : (BAR = 'bar2');
In bash:
[[ $FOO = foo1 ]] && BAR=bar1 || BAR=bar2
In js:
BAR = FOO === 'foo1' ? 'bar1' : FOO === 'foo2' ? 'bar2' : 'bar3';
In bash:
BAR=$(echo $([[ $FOO = foo1 ]] && echo bar1 || ([[ $FOO = foo2 ]] && echo bar2 || echo bar3)))