Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2002 20:52:28 -0600
From:      D J Hawkey Jr <hawkeyd@visi.com>
To:        parv_@yahoo.com, freebsd-questions@freebsd.org
Subject:   [hawkeyd@visi.com: Re: awk - any possibility of using a variable in regex]
Message-ID:  <20020317205228.A22100@sheol.localdomain>

next in thread | raw e-mail | index | archive | help
My bad to reply to myself, but I remember I *do* have something like this,
without the need for perl or awk:

---8<---

#!/bin/sh

for i in ico mouseclock pyro xcursor xearth xfishtank xneko xroach; do
    killall -9 -u $LOGNAME -c $i 2>/dev/null
done

--->8---

----- Forwarded message from D J Hawkey Jr <hawkeyd@visi.com> -----

#!/bin/sh

TMP=/var/tmp/$0.$$

teststop ()
{
    [ `ps -aO ruser |egrep $LOGNAME.+$1 | grep -v grep | tee $TMP | wc -l` -eq 1 ] && kill -9 `cat $TMP | awk '{ print $1 }'`
    rm -f $TMP
}

teststop startx
teststop xinit

----- End forwarded message -----

Dave

-- 
  ______________________                         ______________________
  \__________________   \    D. J. HAWKEY JR.   /   __________________/
     \________________/\     hawkeyd@visi.com    /\________________/
                      http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020317205228.A22100>