From: Nicolas Boisselier Date: Wed, 20 Feb 2019 05:14:41 +0000 (+0000) Subject: etc/profile.d/functions X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=7f168df2f1db9265aa5029545dba34f924cf9254;p=nb.git etc/profile.d/functions --- 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