Reputation: 3391
I'm trying to monitor an infinite task, grepping until the first matching line. This works nicely:
$ adb -L tcp:qa-qemu3.mlan:5037 -s emulator-5616 logcat | grep -m 1 v
05-18 11:34:08.386 21032 21032 D ICU : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
$
I'd like to capture that output into a variable, but when I try the shell gets stuck:
$ F=$(adb -L tcp:qa-qemu3.mlan:5037 -s emulator-5616 logcat | grep -m 1 g)
^C
$ echo $F
--------- beginning of main
$
There are a few obvious file-based workarounds, and for logcat
in particular I can just use the first version, the re-run it in the $()
with -d
, but I'm curious how to avoid $()
getting stuck because all the processes in the pipeline haven't quit. And timeout/timelimit
doesn't work for me.
This is on MacOs High Sierra.
Upvotes: 0
Views: 36