Below code is working fine:
#!/bin/bash
str='fail'
var1='pass'
var2='ok'
var3='fail'
var4='pass'
case $str in
$var1|$var2|$var3|$var4)
echo yes
;;
*) echo no
;;
esac
When I execute this, as expected I get output yes.
In above code, value of variables are not hard-coded, these are coming from previous run, so it keep changing. Here the problem is, sometime it comes like:
var3='partial|fail'
Any variable value can change like this. So in this case it gives no. What should I do change in my code so it handle this situation and match fail word and show the result yes?
var3has the valuepartial|fail, does this allow the two valuespartialandfailforstr, or does it allow the one valuepartial|fail?