Shell

What is the ternary operator? How do you use it in bash?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

A short way of using if/else. An example:

[[ $a = 1 ]] && b="yes, equal" || b="nope"