How to ignore mutiple strings when using shell script?

Hi All,

I am trying to use below syntax to find ignore multiple locations while searching for a file.

find / -name "$serviceitem" ! -size 0  2>&1 |egrep -v "tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest"

I tried to assign all the ignore strings to one variable like below

ignore_list=`tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest`
find / -name "$serviceitem" ! 2>&1 |egrep -v "$ignore_list"

But it's throwing error.

Can someone please let me know how to use the above syntax.

You want alternation:

find / -name "$serviceitem" ! -size 0  -exec egrep -v "(tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest) \;"

Hi
Replace backquotes with single quotes

ignore_list=`tmp|docker|WinSxS|Permission|HISTORY|alternatives|bearer11ssl|manifest`