In Unix, I need an input validation which use grep:
echo $INPUT| grep -E -q '^foo1foo2foo3' || echo "no"
What I really need is if input doesn't match at least one of these values: foo1 foo2 or foo3, exit the program.
Source: syntax is taken from Validating parameters to a Bash script
^foo[123]$.^and$to anchor your matches if you want the entire value to match. Otherwise you could pass values like "foo14" and "aaafoo3zzz".