From 73358f9223a417863535bd68fc9949025860f7bc Mon Sep 17 00:00:00 2001 From: Robert McMahon Date: Fri, 13 Feb 2026 14:10:36 -0800 Subject: [PATCH] Add cleanup message and option to keep temporary pcap file - Show message when deleting temporary pcap file - Add KEEP_PCAP environment variable option to keep the file for analysis Usage: KEEP_PCAP=1 sudo ./test_monitor_tshark.sh wlan0 36 10 Co-authored-by: Cursor --- test_monitor_tshark.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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