Make 'ps' not report itself
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 12 Jun 2019 22:03:30 +0000 (18:03 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 11 Jul 2019 18:29:21 +0000 (14:29 -0400)
This has been an irritant for a very long time.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/kfs/bin/ps

index fcadb84..c4cbfd5 100755 (executable)
@@ -1,6 +1,10 @@
-#!/bin/bash
-for i in `echo '#proc/*/status'`
-do
-cat $i
-echo
+#!/bin/sh
+PID=$$
+for i in \#proc/*/status; do
+       if [ "$i" == "#proc/self/status" ] || \
+          [ "$i" == "#proc/$PID/status" ]; then
+               continue
+       fi
+       cat $i
+       echo
 done