Wie stoppe ich Tshark oder TCPdump, ohne dass die Fehlermeldung „Ausgabe kann nicht geschrieben werden: Pipe defekt“ auftritt?

Wie stoppe ich Tshark oder TCPdump, ohne dass die Fehlermeldung „Ausgabe kann nicht geschrieben werden: Pipe defekt“ auftritt?

Ich muss je nach Bedingung anhalten tcpdumpoder tsharkeine Schleife ausführen. Derzeit verwende ich break.

while IFS= read -r line; do if [[ $line =~ 'some protocol' ]]; then echo $line; break; fi; done < <(sudo tcpdump)

oder

while IFS= read -r line; do if [[ $line =~ 'some protocol' ]]; then echo $line; break; fi; done < <(sudo tshark)

Wie kann ich das so machen, dass ich die Nachricht nicht bekomme?Unable to write output: Broken pipe

verwandte Informationen