I'm trying to save in CORE_NUMBER
the number of cores of my pc. I've tried with:
system_info.sh
#!/bin/bash
cd /proc
CORE_NUMBER= cat cpuinfo | grep processor | wc -l
#...
So that I can do something like:
compile.sh
#!/bin/bash
set -e
../system_info.sh
mkdir -p build && cd build
cmake ..
make -j$CORE_NUMBER
#...
When running ../system_info.sh
, the number of cores is (logically) shown in the terminal.
How can I avoid that, and just assign it to CORE_NUMBER
?
Thanks in advance,
Eduardo