The "shelisp" package is one of the "packages" that emacs can use. (I refer you to the manual about
"packages" to find it.)  It sits on the shell-mode and watches for a certain escape sequence being written to the screen.

When the escape sequence shows up, immediately following should be some elisp code, followed by a terminating sequence.

My example would be that I enter

     $ longrunningcommand.exe ; mydinger.sh

where "mydinger.sh" is a bash script that outputs the escape sequence, then "(ding)", and then the terminating sequence.

That is enough to make the emacs ring a bell and get my attention.

[Please remember, in the post to which this was a reply, I suggest withdrawing the suggestion. I made it quite a while back and don't
need it. Thanks.]