From 7f168df2f1db9265aa5029545dba34f924cf9254 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 20 Feb 2019 05:14:41 +0000 Subject: [PATCH] etc/profile.d/functions --- etc/profile.d/functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 5b6b2216..e00eafef 100755 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -4,6 +4,12 @@ # ################################################################################# type -P which > /dev/null || which() { type -P "$1" 2>&1; } +type -P nproc > /dev/null || nproc() { + case "$OSTYPE" in + darwin*) sysctl -n hw.ncpu ;; + *) awk '/^processor/ {++n} END {print n}' /proc/cpuinfo ;; + esac +} nb_repos() { [ -z "$FUNCNAME" ] && local FUNCNAME='nb_repos' # for busybox -- 2.47.3