From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13866 invoked from network); 2 Sep 2003 12:05:53 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Sep 2003 12:05:53 -0000 Received: (qmail 11706 invoked by alias); 2 Sep 2003 12:05:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18999 Received: (qmail 11691 invoked from network); 2 Sep 2003 12:05:46 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 2 Sep 2003 12:05:46 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [217.174.194.138] by sunsite.dk (MessageWall 1.0.8) with SMTP; 2 Sep 2003 12:5:45 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id h82C5iV31570 for ; Tue, 2 Sep 2003 14:05:44 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <19u9xm-0000QS-00>; Tue, 2 Sep 2003 14:08:46 +0200 Date: Tue, 2 Sep 2003 14:08:46 +0200 From: DervishD To: Zsh Subject: Can Zsh do this for me? Message-ID: <20030902120846.GA1636@DervishD> Mail-Followup-To: Zsh Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4i Organization: Pleyades User-Agent: Mutt/1.4i Hi all :)) I'm writing a command to kill a process by name, not by PID, just like 'pidof' but without using 'pidof' ;))) It's pretty easy using the ps command and a pipeline. Right know, it can be written like this: ps xh | grep name | tr -s " " | cut -d " " -f 2 Since it will be called by root to kill root processes, it will do, and with my ps binary, the options are correct. But I don't want to start four processes just to get the pid of one of them. I can use my /proc filesystem, but I was wondering if Zsh has some facility to get the process ID using the command name, or if I can write the above pipeline in a shorter form using some Zsh capability. BTW, I want to write a 'ps' command on my own because I don't like the procps one available for Linux, nor the others out there, and I think that with the zsh/stat module I could do it in a shell script :))) Well, thanks in advance :)) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/