pgrep: Inverse age selector
Since the original release, the pgrep manual page has said
BUGS
The options -n and -o and -v can not be combined. Let me know if you need to do this.
Last week, David Boersma contacted me to tell me he had a need for this. So here's the code to fix the most longstanding bug in pgrep/pkill.
I believe the implemented behaviour is what people will expect intuitively, ie., that there is a different precedence for the negation operation, the newest/oldest filter, and the other filters.
Without newest/oldest, behaviour is unchanged: pgrep -v
lists processes which do not match all criteria.
With --newest
or --oldest
, we make a list of processes which match the other filters. We then either list the newest/oldest of these processes (without --inverse), or we list all other processes in that list, if any (with --inverse).