SyntaxFix
Write A Post
Hire A Developer
Questions
I think the method you give is the most portable on Linux. Instead of spawning unnecessary cat and wc processes, you can shorten it a bit:
cat
wc
$ grep --count ^processor /proc/cpuinfo 2