While ((var++)) works in bash, it results in an error message (and doesn't increment the variable) in dash, so use a POSIX-compatible construction which works for both of them.
17 lines
300 B
Bash
Executable file
17 lines
300 B
Bash
Executable file
# This script outputs the number of available processors/cores plus one.
|
|
|
|
case `uname` in
|
|
Linux|MSYS*|MINGW*)
|
|
wxPROC_COUNT=`nproc`
|
|
;;
|
|
|
|
Darwin|FreeBSD)
|
|
wxPROC_COUNT=`sysctl -n hw.ncpu`
|
|
;;
|
|
|
|
*)
|
|
wxPROC_COUNT=0
|
|
;;
|
|
esac
|
|
|
|
echo $((wxPROC_COUNT+1))
|