USER=`whoami` X=`ps auwwx |grep $USER|grep -v "grep"|grep startkde`; echo "X is equal to $X" if [ $X ]; then echo "X already running for user $USER" else echo "Starting X" fi