4 ms·
My favorite grep mistake is actually from a related tool pgrep and pkill. pgrep foo -> finds things running matching foo pkill foo -> kills things running
by justinsaccount 6y ago
My favorite grep mistake is actually from a related tool pgrep and pkill.
pgrep foo -> finds things running matching foo
pkill foo -> kills things running matching foo
except every year or so, I do something like this
$ pkill foo
$ echo nothing happened?
$ pkill -9 foo
$ echo nothing happened still? huh?
$ echo ok, let's run this in verbose mode..
$ pkill -9 foo -v
but.. -v isn't verbose. since pkill is part of pgrep, and pgrep is like grep, -v is 'Reverse'.
- alanbernstein 6y agooof
- hackyhacky 6y agoAccording to the man page, related to the -v option: > In pkill's context the short option is disabled to avoid accidental usage of the option. So at least in the version that I have installed (procps-ng 3.3.15), pkill -v results in an error message, not the catastrophic situation suggested by the parent comment.
- zwp 6y agoIt was fixed in 2012. The debian bug report (2009) cites numerous users that fell into the trap before the fix. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558044 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558044 commit 1af18c260a87dc38f0e33bfeb6de6163f91be4ad Author: Sami Kerola <kerolasa@iki.fi> Date: Sat Feb 11 20:33:17 2012 +0100 pkill: remove -v match inversion option The option -v does not make much sense in pkill context.