LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 173|回复: 1

[SOLVED]"pgrep" or "if" command dosen't w

[复制链接]
发表于 2009-9-2 19:47:46 | 显示全部楼层 |阅读模式
hi every
maybe after every upgrade, happens always some problem...
I have typed some codes in my .profile to let X start automatic, when i loggin in tty.
  1. ### if X dosenot exist, then startx.
  2. if !([[ `pgrep -x X` ]]); then
  3.         startx
  4. fi
复制代码
It worked fine for a long time.
But today it happens in tty:
  1. -bash: Desktop: command not funden
复制代码
where does command "Desktop" from?

Then i checked where happened it.
  1. ### if X dosenot exist, then startx.
  2. echo step 1 ok.
  3. if !([[ `pgrep -x X`]]); then
  4.         echo step 2 ok.
  5.         startx
  6.         echo step 3 ok.
  7. fi
复制代码
In tty show only step 1 ok. that means "if ... then" may have some problem~ but it worked fine before today.

when i manually startx, and
  1. alvin ~ $ pgrep -x X
  2. 4063
复制代码
it works..

Can someone help me? i'm real noob
Thank you!
发表于 2009-9-2 19:59:24 | 显示全部楼层
if [ `pgrep -x X` ]; then
        :
else
        startx
fi
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表