3 ms·
awk does that for free. Heck, awk can read /proc just fine. No bash needed.
by anthk 2y ago
awk does that for free.
Heck, awk can read /proc just fine. No bash needed.
- guipsp 2y ago> without ever forking
- Izkata 2y agoYou need one fork to start OP's bash script, and one fork to start awk. No further forking after that.
- izabera 2y agojust type it all in your current live shell manually :)
- fsckboy 2y agoyou can put it in a function, functions don't fork
- AshamedCaptain 2y agoTechnically you don't need to fork bash if you are already running it. ( . AKA source does not fork )
- btilly 2y agoIf you want to launch another process, might as well launch ps. The challenge here is how to get ps in an environment where the command won't run. And in that case, awk won't run either. As for why it might happen, well just save the following shell script and run it on a Linux system. #! /bin/sh $0 & perl -e 'push @big, 1 while 1` & $0 Now that your system is struggling, figure out how to rescue it. (True story. I once worked with a careless programmer who would make mistakes whose results looked like that fairly regularly. It was...an education.)