I'm trying to set up a nested alias, where I can hit the root with one part, then use a pair of arguments to change a set of variables. So far my block looks like this:
if matches[2]=="A" then
if matches[3]=="a" then
A="a"
elseif matches[3]=="b"then
A="b"
else
echo("Generic Error Message Here")
elseif matches[2]=="B" then
if matches[3]=="a" then
B="a"
elseif ...
My question is: Can I simplify the second part of those blocks to look more like
if matches[2]=="A" then
if matches[3]==["a"|"b"|"c"] then
A=matches[3]
else
echo("Generic Error Message Here")
...
or
...
elseif matches[2]=="B" then
if matches[3]=="a" or matches[3]=="b" or matches[3]=="c" then
B=matches[3]
else
echo("Same Error Message Here")
...
or if I need to use full if blocks for the second set.
0
Answers