'grep -c' produces error if result is '0'

I want to use grep -c to get the count of the number of occurances of a pattern in a text file. The result should be just a number, but if the number is “0,” AppleScript considers it an error (if it’s anthing other than 0, it returns the result as expected). I’m getting around this by puting the code in a Try block, but that method seems clunky:

try
	set x to do shell script "grep -c MyString /path/to/MyFile.txt"
on error
	set x to "0"
end try

Any other way? Thanks.

carl, this seemed to work for me

property theFile : "/private/tmp/test.txt"
try
	set x to do shell script "grep -c lkd " & theFile
on error theErr
	set x to "no search string"
	return x
end try