Hello.
I am in the process of writing a little script to automate my use of 3d-desktop (a nifty little eye-candy app)

The script involves checking to see if 3ddeskd is running. So, I test the condition with `ps -e | grep 3ddeskd'. However, ps -e (or any other combo of args like ax) will also echo defunct processes. 3d-desktop tends to zombify sometimes (I don't know why), so in my test condition in the script, the test passes if grep sees "3ddeskd <defunct>". This is not acceptible. The condition should only pass if 3ddeskd is actually running.
So, my questions are:
Can one remove a defunct process without killing its parent? (this would be useful in many situations). If not, how could I filter the output of `ps -e | grep 3ddeskd' to include only the running 3ddeskd, if it exists?
I've tried using regex's in the argument to grep, but none have worked. Perhaps my bash regex skills are not very good.
Any help is appreciated.
Thanks