#!/bin/bash
# /usr/local/bin/alert
# http://crystalfaeries.net/posix/bin/alert
# celeste:crystalfaery 2016-08-24 17:24:42+00:00
# Alert the user via audio, CLI and GUI
# Usage: alert "message to display to user"
# Pop up an alert dialogue on the GUI
echo "DISPLAY=$DISPLAY xmessage Alert: $@ && pkill alert" | at "now"
# UH-OH! WE KILL ALL PENDING ALERTS! BAD! BAD! WE SHOULD TRACK PID!
# Pop up an alert notice on the CLI
echo -n "======= Alert: $@ ======= (^C to silence)"
# Binary Back-Off Audio Alert
player="mplayer"
alert="/usr/share/sounds/gnome/default/alerts/bark.ogg"
let sleep=1
while sleep $sleep;do
let sleep=$sleep+$sleep
"$player" "$alert" > /dev/null 2>&1
sleep 1
echo $@ | festival --tts --pipe
done
exit 0
syntax highlighted by Code2HTML, v. 0.9.1