Re: to shell (and X window System) wizards.

On Wed, Jul 02, 2008 at 07:13:50PM -0700, Gary Kline wrote:

would this works, say in .zlogin, to say that X is up:

if [ -e /tmp/.X11-unix/X0 ]
echo "X is up."
exit 0;
echo "No X yet"
exit 1;

or is there something more clever?

I'm not sure if it's any cleverer, but I would probably make a call to
pgrep(1) instead of relying on the existence of a file that might exist,
even if X isn't running (unusual, but it does happen now and then, here at
least) - something like

if (pgrep "Xorg")
echo "X is up."
exit 0
echo "No X yet..."
exit 1

... should do the trick.

And bear in mind that ~/.zlogin is run *after* ~/.zshrc, whereas ~/.zprofile
is run *before* it. It might matter, depending on what you are trying to do.


Daniel Bye
ASCII ribbon campaign ( )
- against HTML, vCards and X
- proprietary attachments in e-mail / \

Attachment: pgpOFIfG3ULbw.pgp
Description: PGP signature