#!/bin/bash
pkill -f "grep.*USA"

DATE=$(date +%Y-%m-%d_%H%M%S)
LOG_FILE="./dmesg_${DATE}.log"

# 启动后台任务
setsid dmesg -w 2>&1 | grep --line-buffered "USA" >> "$LOG_FILE" 2>&1 &

echo "Dmesg (USA) Started."
sleep 0.5
kill -9 $PPID