MemTotal: 2002424 kB
MemFree: 489596 kB
MemAvailable: 1531392 kB
Buffers: 89700 kB
Cached: 1044156 kB
SwapCached: 0 kB
Active: 716092 kB
Inactive: 621608 kB
Active(anon): 204420 kB
Inactive(anon): 216 kB
Active(file): 511672 kB
Inactive(file): 621392 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 84 kB
Writeback: 0 kB
AnonPages: 203888 kB
Mapped: 149312 kB
Shmem: 796 kB
Slab: 126608 kB
SReclaimable: 79812 kB
SUnreclaim: 46796 kB
KernelStack: 3816 kB
PageTables: 9804 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1001212 kB
Committed_AS: 1220184 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 131048 kB
DirectMap2M: 1927168 kB
DirectMap1G: 0 kB
cat: ‘totalMemInKB=grep MemTotal cat ~/proc/meminfo’: No such file or directory
./check_QBox_server_memory.sh: line 23: test: -ge: unary operator expected
Error: Total Memory of KB is insufficient for QBox
Even I am getting the same error.
Read about how to store the output of bash commands into variables.
And in addition to aforementioned suggestions, how to extract only the relevant value from the command output