I have 3 boolean variables a,b and c. what's the best way to write the if else condition(or some better way) in bash to cover all combinations (refer pic).
for example: a=y,b=y and c=y then echo foo

I can write multiple elseif conditions but is there any alternate way?
Not really sure of what you're expecting precisely, but if you need to check every possible combination, and your variables can only have two values: y or n, then you can use a case statement:
case "$a$b$c" in
yyy) echo bar ;;
yyn) echo foo ;;
yny) echo foo ;;
ynn) echo foo ;;
nyy) echo bar ;;
nyn) echo foo ;;
nny) echo foo ;;
nnn) echo foo ;;
*) echo error; exit 1 ;;
esac
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With