Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Can Zsh do this for me?



    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/



Messages sorted by: Reverse Date, Date, Thread, Author