From b628212ff0c096a2ee454f4eacd954521f6e5beb Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 5 Mar 2019 18:45:37 +0000 Subject: [PATCH] updated split.sh --- split.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/split.sh b/split.sh index 429cf601..18694e47 100755 --- a/split.sh +++ b/split.sh @@ -15,6 +15,9 @@ set -euo pipefail [ -n "${DEBUG:-}" ] && set -x +srcdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. "$srcdir/utils.sh" usage(){ if [ -n "$*" ]; then @@ -43,24 +46,13 @@ for x in $@; do esac done -check_bin(){ - local bin="$1" - if ! which $bin &>/dev/null; then - echo "$bin command not found in \$PATH ($PATH)" - exit 1 - fi -} check_bin split check_bin parallel parts="${PARTS:-}" if [ -z "$parts" ]; then - if [ "$(uname -s)" = "Darwin" ]; then - parts="$(sysctl -n hw.ncpu)" - else - parts="$(awk '/^processor/ {++n} END {print n+1}' /proc/cpuinfo)" - fi + parts="$(cpu_count)" fi for filename in $@; do