I searched with Google and on this site but couldn't find any solution to the following problem. I'm using a ksh function to plot some graphics but need to keep the main gnuplot process open so the plot window (gnuplot_x11) remains interactive, reacting to keyboard shortcuts, zooming in, etc. At the same time I want to continue working on the command-line. So I start gnuplot in the background and in a while loop I check every second if the gnuplot_x11 process was terminated. If yes, then I would kill the main gnuplot process. The problem is that when I close the plot window the gnuplot_x11 process does not disappear from the 'ps' list:
$ ps -fu $USER
UID PID PPID C STIME TTY TIME CMD
user 21037096 55378014 0 09:09:07 pts/1 0:00 gnuplot
user 52428898 21037096 0 09:09:11 pts/1 0:00 gnuplot_x11
user 55378014 721428 0 08:37:56 pts/1 0:02 -ksh
How can I find out if the plot window was closed?