Just looking for any other, perhaps better ways to do the following. Shell check is calling "SC2002 Useless cat" and every other way I have tried to mitigate has failed. It is working as desired, so I am inclined to just leave it alone - unless there are any other ideas out there.
#!/bin/bash
y=0
mapfile -O "$y" -t "ARRAY_NAME" < <(cat "${FILENAME}" | grep "pattern 1" | grep "pattern 2")
Works fine, but hits SC2002 for useless cat. So, I've tried to obvious:
mapfile -O "$y" -t "ARRAY_NAME" < <(grep -e "pattern 1" -e "pattern 2" "${FILENAME}")
No joy - results in "command grep not found"
Now, I can simply read the file, line-by-line into an array with mapfile, but I can't grep out only the lines I need - I can also do the same with read, which is probably better, but have the same grep problems.
So any ideas? Can I just ignore SC2002 in this case?