diff --git a/test_monitor_tshark.sh b/test_monitor_tshark.sh index 6bd7f54..b2a0dc8 100755 --- a/test_monitor_tshark.sh +++ b/test_monitor_tshark.sh @@ -161,8 +161,13 @@ CAPTURE_OUTPUT=$(tshark -q -r "$TEMP_PCAP" -n -T fields \ -e radiotap.present \ 2>/dev/null || true) -# Clean up temp file -rm -f "$TEMP_PCAP" +# Clean up temp file (unless KEEP_PCAP is set) +if [ -z "${KEEP_PCAP:-}" ]; then + echo "Cleaning up temporary pcap file: $TEMP_PCAP" + rm -f "$TEMP_PCAP" +else + echo "Keeping temporary pcap file: $TEMP_PCAP" +fi # Force output flush sync