2019-07-28 21:17:43 -0700, L A Walsh: > Is there a T/F var expansion that does: > > var=${tst:+$yes}${tst:-$no} > > but with yes/no in 1 expansion? [...]
You can also do: no_yes=(no yes) echo "${no_yes[${var+1}]}" For the reverse: echo "${no_yes[!0${var+1}]}" See also: map=(unset empty non-empty) echo "${map[${var+1}+0${var:+1}]}" -- Stephane