adb shell logcat | grep -Fqm 1 "TestProcess test service stopped" && echo "Test Service finished"
grep flags:
-F - treat string literally, not as a regular expression-q - do not print anything to standard output-m 1 - stop after the first match
The command after && is only executed if grep finds a match. As long as you “know” grep will eventually match up and want to continue unconditionally, as soon as he returns, just leave && ...
source share