You are not logged in.
Hello 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.
### if X dosenot exist, then startx.
if !([[ `pgrep -x X` ]]); then
startx
fi
It worked fine for a long time.:D
But today it happens in tty:
-bash: Desktop: command not funden
where does command "Desktop" from?
Then i checked where happened it.
### if X dosenot exist, then startx.
echo step 1 ok.
if !([[ `pgrep -x X`]]); then
echo step 2 ok.
startx
echo step 3 ok.
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
alvin ~ $ pgrep -x X
4063
it works..
Can someone help me? i'm real noob
Thank you!
Last edited by alvin_rxg (2009-09-02 11:54:54)
real newbie
Offline
I would have done it the following way although if your code worked previously then I don't know why it no longer does.
[ -z "$(pgrep -x X)" ] && startx
or
[ -z "$(pidof X)" ] && startx
Last edited by Xyne (2009-09-02 10:46:26)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I would have done it the following way although if your code worked previously then I don't know why it no longer does.
[ -z "$(pgrep -x X)" ] && startx
or
[ -z "$(pidof X)" ] && startx
thank you for your reply.
and how to type the command?
it shows
-bash: [-z: command not funden
real newbie
Offline
It's probably related to the backticks in `pgrep -x X`. It tries to execute the output/pid. So you need to either test whether the output is empty like Xyne said, or lose the test entirely (pgrep itself returns success/fail) if ! pgrep -x X; then ...
Offline
Xyne wrote:I would have done it the following way although if your code worked previously then I don't know why it no longer does.
[ -z "$(pgrep -x X)" ] && startx
or
[ -z "$(pidof X)" ] && startx
thank you for your reply.
and how to type the command?
it shows-bash: [-z: command not funden
You must put a blank space between [ and -z, and another one between the inverted commas and the ].
Offline
than you all.
just forget the space..
think i have to learn some more about bash.
real newbie
Offline