What's the easiest way for me to pop up an error-message dialog box from
a shell script? It doesn't have to be fancy; I just want to tell people
that a program doesn't exist any more. Bonus points for Motif look and
feel.
This is for Solaris running CDE, so our options seem to be:
* dtksh
* Tk/Tcl
* an X11/Motif compiled application
I'd like to pick up something from the net, of course, or at least not
have to write it myself. I could modify something that was freely
available, but if I have to write it from scratch it won't get written.
HP-UX has a program called xdialog that does what we need, but that's
only on HP-UX. Its sources aren't available anywhere that I could find.
The cheap workaround is to pop up an xterm with a shell behind it that
blats the message to stdout, then exits after the user types Return.
The script is attached in shar format (encased in MIME).
-- bd
[
t 1K ]
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: popup
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'popup' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'popup'\"
else
echo shar: Extracting \"'popup'\" \(1022 characters\)
sed "s/^X//" >'popup' <<'END_OF_FILE'
X#! /bin/ksh
X
X# Cheap and cheerful script to pop up an "error dialog box",
X# to use the term loosely.
X
X# get the offending program name into the dialog box
Xcat >/tmp/popup.$$ <<\EOF
X#! /bin/ksh
X: pop up a pseudo-dialog-box and return an error
XTERM=xterm PATH=/bin:/usr/bin:$PATH
Xtput bold
Xecho " W a r n i n g"
Xtput rmso
X
Xcat <<EOM
X
XThe program $1 does not work under Solaris.
XPlease remove it from your ~/.mailrc file.
X
XThe line in your ~/.mailrc probably looks like this:
X set sendmail='$1'
X
XTo comment it out instead of deleting it, use the \`#' character:
X # set sendmail='$1'
X
XThen, after editing, exit your mail-reading program and restart it.
X
X
XEOM
X
Xread junk?"Press Return after you have done this: "
Xexit 0
XEOF
X
Xchmod +x /tmp/popup.$$
Xxterm -title "/usr/local/bin/signmymail is old" -geometry 80x15 \
X -font screen16 -bg Navy -fg PapayaWhip -ms Navy -cr Red \
X -e /tmp/popup.$$ /usr/local/bin/signmymail
Xrm -f /tmp/popup.$$
X
X# inform dtmail that we failed so that it will inform the user
Xexit 99
END_OF_FILE
if test 1022 -ne `wc -c <'popup'`; then
echo shar: \"'popup'\" unpacked with wrong size!
fi
chmod +x 'popup'
# end of 'popup'
fi
echo shar: End of shell archive.
exit 0