I'm trying to get the PID of tcpdump which is part of a while loop. Example:
tcpdump -x -q -l -i $IFACE port $PORT | while read buffer; do
# process, if something received from tcpdump. Otherwise wait
done
$! within the while loop will not provide the PID of tcpdump.
How to get the PID of tcpdump in this construct?