#!/bin/bash

# Do I Run In a Terminal Window?

if [ "x$DISPLAY" != "x" ]; then
  a=0
  PP=$PPID
  while [ $a -eq 0 ]; do
    p=$(ps -q $PP -o ppid,comm | tail -1) 
    PP=$(echo $p|cut -d\  -f1)
    COM=$(echo $p|cut -d\  -f2)
    if [ $PP -eq 0 ]; then
      a=2
    fi
    if [ $COM == "xfce4-terminal" ]; then
      a=1
    fi
  done
  echo $a
  if [ $a -ne 1 ]; then
    xfce4-terminal -e $1 $2 $3 $4 $5
    exit 0
  fi
  exit 1
if
