On some systems the `bc` command is not installed, so I added a check if the command can be used. It is a simply calculation from KB to GB. If `bc` is missing, then it is displayed in KB. fix: #1151
This commit is contained in:
parent
d205f4a433
commit
87a37da243
@ -130,9 +130,15 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
|||||||
echo "ERR: Sorry this is working only on x86_64!"
|
echo "ERR: Sorry this is working only on x86_64!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " : --- Memory, CPU info ---- "
|
echo " : --- Memory, CPU info ---- "
|
||||||
mem=$( grep MemTotal /proc/meminfo | awk '{print $2}' | xargs -I {} echo "scale=4; {}/1024^2" | bc )
|
if [ -n "$(command -v bc)" ]; then
|
||||||
echo "System memory (GB): ${mem}"
|
mem=$( grep MemTotal /proc/meminfo | awk '{print $2}' | xargs -I {} echo "scale=4; {}/1024^2" | bc )
|
||||||
|
echo "System memory (GB): ${mem}"
|
||||||
|
else
|
||||||
|
mem=$( grep MemTotal /proc/meminfo | awk '{print $2}')
|
||||||
|
echo "System memory (KB): ${mem}"
|
||||||
|
fi
|
||||||
grep SwapTotal /proc/meminfo
|
grep SwapTotal /proc/meminfo
|
||||||
echo "CPU number: $(grep -c processor /proc/cpuinfo) x $(grep "bogomips" /proc/cpuinfo | head -1)"
|
echo "CPU number: $(grep -c processor /proc/cpuinfo) x $(grep "bogomips" /proc/cpuinfo | head -1)"
|
||||||
grep Free /proc/meminfo
|
grep Free /proc/meminfo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user