couldn't find a specific string on a variable containing file content
#!/bin/bash
core_pattern=$(cat /proc/sys/kernel/core_pattern)
apport_full_path="/usr/share/apport/apport"
if [[ $(grep "$apport_full_path" "$core_pattern") ]] ; then
echo "Found"
else
echo "Not Found"
fi
grep: |/usr/share/apport/apport %p %s %c %d %P: No such file or directory
Not Found
I expect an output of "Found" or "Not Found" but ending up with an error