I want to execute a command only if a file does not contain the search. The line I'm searching is the last line of the file. Here's what I have so far:
if tail -n 1 debug.txt | [[ $( grep -q -c pass ) -eq 0 ]]; then
echo "pass"
else
echo "fail"
fi
This code is outputting "pass" whether the file contains that string or not.
Maybe there is a much easier way to do this too.