I want to exclude some files from my command grep, for this I use the parameter:
--exclude=excluded_file.ext
To make reading easier, I want to use a bash array with excluded files:
EXCLUDED_FILES=("excluded_file.ext")
Then pass the array $ {EXCLUDED_FILES} to grep, for example:
grep -Rni "my text" --exclude=${EXCLUDED_FILES}
How to pass an array as a parameter to a command grep?
source
share