[WIP]:Return value of pgrep is incorrect on RHEL6
Issue
- The return value of pgrep command on RHEL6.4 is different from previous versions and description in man page.
On RHEL5.X
$ uname -r
2.6.18-348.el5
$ pgrep -u root brabrabra bra
Usage: pgrep [-flvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST]
[-s SIDLIST]
[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST]
[PATTERN]
$ echo $?
2
On RHEL6.X
# uname -r
2.6.32-358.el6.x86_64
# pgrep -u root brabrabra bra
Usage: pgrep [-flvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST]
[-s SIDLIST]
[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST]
[PATTERN]
# echo $?
0
We consider the return value above should be 2
instead of 0.
A manpage of pgrep says:
EXIT STATUS
0 One or more processes matched the criteria.
1 No processes matched.
2 Syntax error in the command line.
3 Fatal error: out of memory etc
So the return value of 6.X is incorrect.
Environment
- RHEL6.4
- procps
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
