Skip to content

Instantly share code, notes, and snippets.

@yeliu84
Forked from jj1bdx/cpus.sh
Last active August 29, 2015 14:21
Show Gist options
  • Save yeliu84/b761cfa0342838de5145 to your computer and use it in GitHub Desktop.
Save yeliu84/b761cfa0342838de5145 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Originally from:
# https://github.com/blankpage/e5UNIXBuilder/blob/master/build-akili.sh
# Linux and similar...
CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
# FreeBSD and similar...
[ -z "$CPUS" ] && CPUS=`getconf NPROCESSORS_ONLN`
# Solaris and similar...
[ -z "$CPUS" ] && CPUS=`ksh93 -c 'getconf NPROCESSORS_ONLN'`
# Give up...
[ -z "$CPUS" ] && CPUS=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment