pgrep uses `OR' when two options are provided.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pgrep uses `OR' when two options are provided.

Han Boetes
Hi,

This is the output on OpenBSD:

~% ps auxww G ssh
root      3639  0.0  0.0  3088     4 ??  IWs    6:53AM    0:00.06 sshd: han [priv] (sshd)
han       8438  0.0  0.1  3092  1128 ??  S      6:53AM    0:05.79 sshd: han@ttyp0 (sshd)
han      28277  0.0  0.1   236   496 p6  S+    10:45PM    0:00.01 grep ssh
han         75  0.0  0.1   544   560 p8  Ss+    6:54AM    0:04.05 ssh bascuppen@marsupilami
root      7258  0.0  0.0   340   120 C0- I     Sun08PM    0:00.01 supervise sshd
root     30685  0.0  0.0   612     4 C0- IW    Sun08PM    0:00.06 /usr/sbin/sshd -D -e -4
_sshdld  23581  0.0  0.0   376     4 C0- IW    Sun08PM    0:00.01 /usr/local/bin/multilog t s250000 n4 !/usr/bin/gzip /var/log/sshd
~% pgrep  -f /usr/sbin/sshd
30685
~% pgrep  -f /usr/sbin/sshd -u root
32396
31673
30685
~% ps auxww |grep 31673
qmaild   31673  0.0  0.0   276   156 C0- I     Sun08PM    0:00.05 /usr/local/bin/tcpserver -v -p -x /var/qmail/control/tcp.smtp.cdb -u 1008 -g 1000 0 smtp /var/qmail/bin/qmail-smtpd
~% ps auxww |grep 32396
www      32396  0.0  0.1  1384   884 ??  Ss    Sun08PM    0:06.43 httpd: parent [chroot /var/www] (httpd)

Looks like pgrep uses `OR' instead of what I'd expect, namely `AND'. Is this OK?


If I use the same commands on my linuxbox I get:
~% ps auxww |grep sshd
root       544  0.0  0.0   3584   952 ?        Ss   06:52   0:00 /usr/sbin/sshd
root      1353  0.0  0.1   6168  1908 ?        Ss   06:54   0:00 sshd: bascuppen [priv]
1006      1355  0.0  0.1   6168  1160 ?        S    06:54   0:00 sshd: bascuppen@pts/2
~% pgrep -f /usr/sbin/sshd -u root
544
~% pgrep -f /usr/sbin/sshd        
544




# Han