>>929
grep にこだわらくても良くて、GNU sed を使ってもいい場合:

$ echo test | sed '/a/!q1'
test
$ echo $?
1