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 ]
then
echo "X is up."
exit 0;
else
echo "No X yet"
exit 1;
fi

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")
then
echo "X is up."
exit 0
else
echo "No X yet..."
exit 1
fi

... 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.

Dan

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

Attachment: pgpOFIfG3ULbw.pgp
Description: PGP signature



Relevant Pages

  • Re: Newbie Three
    ... echo "tesgform"; ... echo "suspected alien invasion case topic table"; ... echo "suspected alien invasion unknown group name"; ...
    (comp.lang.php)
  • Newbie Three
    ... echo "tesgform"; ... echo "suspected alien invasion case topic table"; ... echo "suspected alien invasion unknown group name"; ...
    (comp.lang.php)
  • [opensuse] Re: lack of flexibility of systemd
    ... # best to sudo first then run this script: ... # read the daemon's current config to get values...for defaults ... echo "Fatal error: Torrent data directories are not found" ...
    (SuSE)
  • ToDo list utility - suggestions/optimizations/refinements wanted
    ... For the past couple of days, I've been working on this todo list script and I'm really happy with the way it works, but wanted to post it here before I go any futher, in case anybody had suggestions for optimizations or style errors. ... echo "File written successfully." ...
    (comp.unix.shell)
  • Re: Shell Script to Remove Old Files
    ... Note it needs a TSM server: ... # Verify command line arguments ... echo "\nError: $STARTDIR does not exist.\n" ...
    (comp.unix.admin)