vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I always find it annoying having to echo $? after a pkill or use other quirks to see if i typed the command incorrectly, and I would like to see some warning if there were no matching processes. So, here's a little patch to do just that. It only does this for pkill, since it's obvious pgrep prints an empty line if no processes matched. Perhaps it would also make sense to errx if rv == STATUS_ERROR? Index: pkill.c ================================================== ================= RCS file: /cvs/src/usr.bin/pkill/pkill.c,v retrieving revision 1.14 diff -u -r1.14 pkill.c --- pkill.c 16 Jul 2005 11:48:46 -0000 1.14 +++ pkill.c 18 May 2006 16:45:20 -0000 @@ -405,6 +405,10 @@ else if (rv != STATUS_ERROR) rv = STATUS_MATCH; } + + if (!pgrep && rv == STATUS_NOMATCH) + warnx("%s", "no matching processes found"); + if (pgrep && j) putchar('\n'); |