Simple script to watch dmesg for changes, something like “dmesg --follow” or “dmesg -w” on systems with a real dmesg command.
:
#
# watch dmesg output on the mac for new results... useful since the mac
# doesn't support the --follow/-w/etc. opts (at least for now!)
# tries to update every second
#
# number of seconds to sleep
SLEEPY=1
prev=$(mktemp)
curr=$(mktemp)
# get rid of temp files on exit
trap "rm -f $prev $curr" EXIT
# initial... send to screen and tmp file
dmesg | tee -a "$prev"
# loop-till-I-can't-loop-no-mo
while true; do
# get the latest, compare
dmesg > "$curr"
diff "$prev" "$curr" | grep '^>' | cut -c3-
# move new to the old, snooze, repeat
mv "$curr" "$prev"
sleep $SLEEPY
done
#
# watch dmesg output on the mac for new results... useful since the mac
# doesn't support the --follow/-w/etc. opts (at least for now!)
# tries to update every second
#
# number of seconds to sleep
SLEEPY=1
prev=$(mktemp)
curr=$(mktemp)
# get rid of temp files on exit
trap "rm -f $prev $curr" EXIT
# initial... send to screen and tmp file
dmesg | tee -a "$prev"
# loop-till-I-can't-loop-no-mo
while true; do
# get the latest, compare
dmesg > "$curr"
diff "$prev" "$curr" | grep '^>' | cut -c3-
# move new to the old, snooze, repeat
mv "$curr" "$prev"
sleep $SLEEPY
done