Ansgar Burchardt <[email protected]> (27/01/2011):
> Reuben Thomas <[email protected]> writes:
> > Can this be done? It’s pretty easy, after all:
> >
> > grep processor /proc/cpuinfo | wc -l

Spare pipes! grep -c ^processor /proc/cpuinfo

> That is not portable. For example on armel (agricola.d.o) this gives:
> 
>   $ grep processor /proc/cpuinfo | wc -l
>   0
> 
> And there is also kfreebsd and Hurd which likely differ in what they
> provide in /proc as well.

getconf/sysconf to the rescue.

getconf _NPROCESSORS_{ONLN,CONF}

KiBi.

Attachment: signature.asc
Description: Digital signature

Reply via email to