Created
January 8, 2014 20:37
-
-
Save coderofsalvation/8324175 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# flexible xmessage (uses xmessage or gmessage) or printf for printing messages | |
function x11message() | |
{ #prints a message using xmessage || gxmessage | |
[ -z "$1" ] && return 1 | |
XMESSAGE=$(command -v gxmessage 2>/dev/null) || XMESSAGE=$(command -v xmessage 2>/dev/null) | |
MESSAGE="$(expr "$0" : '.*/\([^/]*\)'): $*" | |
printf "%s\\n" "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2 | |
if [ -n "$DISPLAY" ] && [ -n "$XMESSAGE" ]; then | |
printf "%s\\n" "$MESSAGE" | fold -s -w ${COLUMNS:-80} | $XMESSAGE -center -file - | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment