Created
August 11, 2016 14:37
-
-
Save sleekweasel/39d955f369a556ef00c8f61244356904 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Logs to stdout, maintaining an xmessage based status. | |
# Messages starting with space are appended. | |
# Magic { & } 2>/dev/null stuff is to suppress job control noise. | |
xlog() { | |
[ -n "$XM_PID" ] && { kill $XM_PID && wait $XM_PID ; } 2>/dev/null | |
XM_STATE="$(uptime)" | |
echo === ${XM_STATE} "$*" | |
case "$*" in (' '*) XM_MESSAGE+=" | |
$*" ;; (*) XM_MESSAGE="$*" ;; esac | |
{ ( xmessage -buttons '' ${XM_STATE} "$XM_MESSAGE" )& } 2>/dev/null | |
XM_PID=$! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment