On 2020-05-31 Adam Thompson wrote:
arping(8) solution:
Ya, I figured there would be other networky ways to do it. But I purposely was trying to use ICMP rather than arp, for the exact opposite reason you stated: I prefer braindead or firewalled/hidden hosts to not count in my scan.
If you forget about the network aspect of the problem, though, surely there must be an easier way to stop a "producer" program earlier in the pipe once you get the output you're looking for? Would seem like a common-ish problem if your producer is long-running and not listening for the proper signals?
Ignoring the network aspect, no one knows a better way? Maybe I need to write a little something for moreutils! Or maybe head could be tweaked to do the work? ... guess it wouldn't know who is the start of the pipe if it's >2 ps's...