Re: pkill and pgrep: reality check

Walter Webb <[email protected]>
Newsgroups gmane.linux.lfs.general
Message-ID <[email protected]>
Emanuele Rusconi wrote:
> On 9 February 2015 at 18:29, Walter Webb <[email protected]> wrote:
>>
>> While investigating some odd behavior of pkill(1), I discovered
>> that pkill and pgrep match any name that has the argument as a
>> substring.
>>
>>     pgrep e
>>
>>          outputs a long list of pid's.
>>
>>     pgrep ""
>>
>>          outputs all pid's.
>>
>> I tried pgrep on the oldest distribution I had still running,
>> Slackware-11.0 (according to Wikipedia, released 2006-10-02).
>> The result was the same.  It seems too old to be a bug; but
>> the man page is buggy for not giving a big fat WARNING.
>> Or am I the only user of pkill?
>
>
> How is this unexpected behaviour?? It's perfectly consistent with
> grep's behaviour.
>
> If you read the man page, you'll find that you can use the "-x" option
> to exactly match the name.
>
> --
> Emanuele
>
Oops!

Well that's what I get for believing the description, which says

		$ pgrep -u root sshd

	will only list the processes called sshd AND owned by root.

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.