I was tinkering a little bit and I noticed something strange. I admit that I don't know the answer to this riddle (yet), but more than willing to let you shine your brilliant lights:
When I am in a terminal and I type
ps -ef | wc -l
The result is what one'd think: the total of all processes +1 (header) (let's say 180)
Now where I got tinkering:
$0 -c ps -ef | wc -l
The result here is 4
So the big question is: why can't ps "see" all processes when called within a separate shell?
Exercises to be done:
what does it do within a script that calls a new shell (she-banged)
Is this behaviour the same when doing this little joke as root.
But first, can anyone solve this little riddle?