Remove unnecessary "cat" operations

This commit is contained in:
Lars Kruse 2020-02-08 04:47:48 +01:00
parent 0600bbf113
commit 974b07a1af

View file

@ -1,5 +1,5 @@
config_memory() { config_memory() {
MINFO=$(cat /proc/meminfo | sed 's/ \{1,\}/ /g;') MINFO=$(sed 's/ \{1,\}/ /g;' /proc/meminfo)
MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2) MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2)
PAGETABLES=$(echo "$MINFO" | grep "^PageTables:" | cut -d\ -f2) PAGETABLES=$(echo "$MINFO" | grep "^PageTables:" | cut -d\ -f2)
SWAPCACHED=$(echo "$MINFO" | grep "^SwapCached:" | cut -d\ -f2) SWAPCACHED=$(echo "$MINFO" | grep "^SwapCached:" | cut -d\ -f2)
@ -109,7 +109,7 @@ config_memory() {
fi fi
} }
fetch_memory() { fetch_memory() {
MINFO=$(cat /proc/meminfo | sed 's/ \{1,\}/ /g;') MINFO=$(sed 's/ \{1,\}/ /g;' /proc/meminfo)
MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2) MEMTOTAL=$(echo "$MINFO" | grep "^MemTotal:" | cut -d\ -f2)
MEMFREE=$(echo "$MINFO" | grep "^MemFree:" | cut -d\ -f2) MEMFREE=$(echo "$MINFO" | grep "^MemFree:" | cut -d\ -f2)
BUFFERS=$(echo "$MINFO" | grep "^Buffers:" | cut -d\ -f2) BUFFERS=$(echo "$MINFO" | grep "^Buffers:" | cut -d\ -f2)