pgrep does not recognise "\b"
Status: Beta
Brought to you by:
wfaulk
Using proctools version 0.4pre1 on OSX (10.7.5)
What I did (running as root):
$ pgrep -fl cron
60 /usr/sbin/cron
$ pgrep -fl "cron\b"
$ ps -ef | grep -v grep | grep -E "cron"
0 60 1 0 12:32pm ?? 0:00.01 /usr/sbin/cron
$ ps -ef | grep -v grep | grep -E "cron\b"
0 60 1 0 12:32pm ?? 0:00.01 /usr/sbin/cron
What I expected:
pgrep should have found cron on the second invocation, as the "\b" should indicate end-of-word, which should be found, as it is by the second grep invocation
Your
grepseems to use ENHANCED FEATURES descibed in re_format(7), whereas proctools use extended regular expressions defined in POSIX.Using ENHANCED FEATURES is easy (simply replace
REG_EXTENDEDwithREG_ENHANCEDinregcomp()) but may have a portability issue.Last edit: Wataru Ashihara 2018-02-26