This works but, again, it's not ideal and someone with a knowledge of scripting ought to be able to point out a correct solution:
Code:
#!/bin/bash
if [[ -n `cat log/output.tst | grep "MYDB"` ]] && [[ -n `cat log/output.tst | grep "DUMMY"` ]] ; then
echo "found it!"
fi
The logic of this is that you're using cat to pipe the file to grep, if you then just add another pipe to grep again as you did it will be working on the line returned by grep and not the whole file. I added a logical and so that both of the expressions need to be not null to enter the if statement.
Remember that the pipe | is just passing the result of the previous action not the whole file. This was my point about passing the result of ls to grep but I'm not familiar enough with the logic of bash to know whether there was an exception there somewhere.