I want to create a case statement including two expressions, my imagination is to look like this :
a=true
b=false
case [ "$a" || "$b"] in #<-- how can I do this with a case statement ?
true)echo "a & b are true" ;;
false)echo "a or b are not true" ;;
esac
Is it possible to do it with case instead of if ?
Thanks
help case. It iscase word in ..., which means you could writecase "foo" in "foo") echo "foo found" ;; esac.case WORD in,WORDmust be a character string. Therefore the problem is how to turn a logical operation result into a string. As I said, thebasharithmetic$((···))returns a string, unlike[···]and[[···]]do, but their logical outcomes can be checked using$?.$a or $bin a variable and then use a case statement on that variable.