awk can't always be trusted for math (mawk bad)

This commit is contained in:
the-sane committed 2023-03-21 22:10:11 -04:00
1 parent 4618dfed61
commit c4d5a5a3dd
1 file changed
+5 -3
+5 -3
View File
@@ -901,9 +901,11 @@ winetricks_check() {
# Check system memory and swap space
memory_check() {
# Get totals in bytes
memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf $2*1024}' /proc/meminfo)"
swaptotal="$(LC_NUMERIC=C awk '/SwapTotal/ {printf $2*1024}' /proc/meminfo)"
# Get totals in KB
memtotal="$(LC_NUMERIC=C awk '/MemTotal/ {printf $2}' /proc/meminfo)"
swaptotal="$(LC_NUMERIC=C awk '/SwapTotal/ {printf $2}' /proc/meminfo)"
memtotal="$(($memtotal * 1024))"
swaptotal="$(($swaptotal * 1024))"
combtotal="$(($memtotal + $swaptotal))"
# Convert to GiB