如何停止 tshark 或 tcpdump 而不會出現「無法寫入輸出:管道損壞」錯誤?

如何停止 tshark 或 tcpdump 而不會出現「無法寫入輸出:管道損壞」錯誤?

我需要根據條件停止tcpdump或循環。tshark目前我正在使用break.

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

或者

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

我怎麼能以一種我沒有收到消息的方式做到這一點Unable to write output: Broken pipe

相關內容