I have excludes
as a variable, where it's meant to be a list of regexes to pass to grep:
$ echo $excludes
-e re_1 -e re_2 -e re_3...
I'd like to be able to do something like
$ my | pipeline | grep -v "${excludes}"
but this doesn't work.
I also tried using an array as in grep -v "${excludes[@]}"
where each array member is "-e blah". This didn't work either.
How can I pass arguments in a programmatic way like this?
set -f
), which isn't likely to be good since regexes often contain the very same characters that are special in globs... – ilkkachu Dec 06 '17 at 20:24