diff --git a/tools/toolchain/install_cp2k_toolchain.sh b/tools/toolchain/install_cp2k_toolchain.sh index 63571f620f..ab835b6d19 100755 --- a/tools/toolchain/install_cp2k_toolchain.sh +++ b/tools/toolchain/install_cp2k_toolchain.sh @@ -374,7 +374,19 @@ while [ $# -ge 1 ]; do case ${1} in -j) shift - export NPROCS_OVERWRITE="${1}" + case "${1}" in + -*) + export NPROCS_OVERWRITE="$(get_nprocs)" + ;; + [0-9]*) + export NPROCS_OVERWRITE="${1}" + ;; + *) + report_error ${LINENO} \ + "The -j flag can only be followed by an integer number, found ${1}." + exit 1 + ;; + esac ;; -j[0-9]*) export NPROCS_OVERWRITE="${1#-j}"