The base module requires grep with the `rd.memdebug=1` command line parameter.
As this code is broken if grep is not added by other means and grep is only
required for this, rewriting this code to avoid the dependency.
show_memstats() {
case $1 in
shortmem)
- grep -e "^MemFree" -e "^Cached" -e "^Slab" /proc/meminfo
+ while read -r line || [ -n "$line" ]; do
+ str_starts "$line" "MemFree" \
+ || str_starts "$line" "Cached" \
+ || str_starts "$line" "Slab" \
+ || continue
+ echo "$line"
+ done < /proc/meminfo
;;
mem)
cat /proc/meminfo