From owner-freebsd-hackers Sun Aug 30 06:50:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA22300 for freebsd-hackers-outgoing; Sun, 30 Aug 1998 06:50:20 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from a486n1.znh.org (dialup3.gaffaneys.com [208.155.161.53]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA22294 for ; Sun, 30 Aug 1998 06:50:13 -0700 (PDT) (envelope-from zach@gaffaneys.com) Received: (from zach@localhost) by a486n1.znh.org (8.9.1/8.9.1) id NAA04190; Sun, 30 Aug 1998 13:49:18 GMT (envelope-from zach) Message-ID: <19980830084917.A4163@znh.org.> Date: Sun, 30 Aug 1998 08:49:17 -0500 From: Zach Heilig To: Kelly Yancey , Joel Ray Holveck Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: determining an X window ID? References: <199808300355.WAA05971@detlev.UUCP> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: ; from Kelly Yancey on Sun, Aug 30, 1998 at 05:26:19AM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, Aug 30, 1998 at 05:26:19AM -0400, Kelly Yancey wrote: > The old fashioned way...it checks for each of them in the output of ps > :) > Actually it's not too bad. I broke it into two loops: the first checks > for all the X-based cd players (xmcd, xcdplayer, etc), with the hope that > one day I'll be able to set focus on them. And the second checks for > command-line cd players (cdplay, cda, etc.)...I don't know what I could > do if they are running, but it definately isn't to try and start another > cd player :). You could use 'egrep' instead of a for loop and grep: #!/bin/sh ps -cawx | egrep -w "xmcd|workman|xcdplayer|cda|cdplay" > /dev/null 2>&1 if [ $? -ne 0 ]; then xmcd $@ & fi /usr/sbin/cdcontrol can play cd's as well. -- Zach Heilig -- zach@gaffaneys.com Anyone who is capable of getting themselves made President should on no account be allowed to do the job. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message