if [ foo = bar -o foo = car -o foo = jar -o foo = foo ]
then
echo yes
fi
To keep things more organized, I would like to try to match it to a list, such as
if [ foo = {bar,car,jar,foo} ] ; then
Obviously the curly brace expansion method didn't work or else I wouldn't be here!
But I would like to know if something like this is possible at all.
Best Answer
I suggest using case structure. Something like:
If you like, you can add a command between
*)
and;;
to be executed when$foo
doesn't matchfoo
,car
,bar
, orjar
. For example, you could print a message withecho 'wrong input'
or something like that.