#! /bin/bash set -e DIR="$HOME/var/log/dmesg" FILE="$DIR/warning.log" mkdir -p "$DIR" sleep 3 # wait for dunst to hopefully restart # TODO File with ignore patterns sudo dmesg --follow --level=warn --since=now --ctime \ | while read -r line do notify-send -u low 'dmesg warning' "$line" echo "$line" >> "$FILE" done