xterm detect

i have this script that launches multiple xterm sessionon a CDE. i would like to test the xterm so that when i execute the script using an ordinary terminal it will detect that it will unable to launch the xterm and execute other script instead.

i tried using trap and exit status. maybe i am doing something wrong. pls help.

thanks,

i just record the process id (using $!) when i launched the application and wait for a few seconds then check it with the "ps -ef" command. since the box will automatically kill the process if it is not possible to launch the application otherwise it will register in the "ps -ef".

thanks,

Do you have a seperate startup file for your CDE sessions - I know old HP VUE/CDE did/does, but I'm not sure what OS you're using.

Also, a little kludge may be to check for the existance of the DISPLAY variable. In modern shells, you can do:

...
if [ -n "$DISPLAY" ]; then
  nohup xterm >/dev/ull 2>&1
fi
...

or, more portably,

...
if [ X$DISPLAY = X ]; then
  nohup xterm >/dev/null 2>&1
fi