The case
statement (as lots of things in shell programming) only works on strings. How you build those strings, maybe out of several variables, is completely up to you. If you combine several variables using sth like +
, please keep in mind that the chosen combination character can in principle be part of the values. So one+two
combined with three
using the combination character +
will result in the same as one
combined with two+three
. But in typical cases you probably can choose a combination character which you can be sure of to be not part of the values.
So your approach of combining two variables to one string value (using $ch+$sys
) is completely valid as long as the +
does not appear inside your variables as well. As you did, you just have to use corresponding match values in the different cases, that's it.
From what you posted I cannot derive the semantics of your code (names like ch
and sys
and values like lin
and rin
are too ambiguous for that). So please be more elaborate about the "conditions" you mention in your last sentence.
What your code currently does is sth like this in pseudo code:
if sys = "lin" or ch = "02" then at ← C2
elif sys = "rin" or ch = "02" then at ← 057
elif sys = "lin" or ch = "05" then at ← C1
elif sys = "rin" or ch = "05" then at ← 0123
And this is probably nonsense because at least the last case never can happen (either the second or the third case would happen then and thus prevent the last case).
So maybe you want to rephrase what you in fact wanted, then we can give clearer advice on how to achieve it.