I want to create a case statement including two expressions, my imagination is to look like this :
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" ;;
This is an example but it's about strings, not real logical expressions:
$ cat > foo.sh a=true b=false case $a$b in # "catenate" a and b, two strings *false*) # if there is substring false (ie. truefalse, falsetrue or falsefalse) in there echo false # it's false ;; *) echo true # otherwise it must be true ;; esac $ bash foo.sh false