#!/bin/sh hascmd() { # because `which` is non-POSIX type "$1" >/dev/null 2>&1 return $? } # title, text, detail msgbox() { echo " #-------[ $1 ]-------- # $2 #--------------------------------- $3 " if [ -n "$DISPLAY" ]; then if hascmd kdialog; then kdialog --error "$2\n\n$3" --title "$1" 2>/dev/null # kdialog auto-expands \n elif hascmd zenity; then zenity --error --title="$1" --text="$2\n\n$3" # zenity auto-expands \n elif hascmd wish; then echo "tk_messageBox -type ok -title \"$1\" -message \"$2\" -icon error -detail \"$3\"; exit" | wish elif hascmd osascript; then # apple specific /usr/bin/osascript <