mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-12-22 13:52:13 +01:00
Simplify grep-based conditionals
The "-q" argument avoids the requirement for output redirections.
This commit is contained in:
parent
94a695860d
commit
0600bbf113
1 changed files with 2 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
config_cpu() {
|
||||
extinfo=""
|
||||
if grep '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat >/dev/null 2>&1; then
|
||||
if grep -q '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat; then
|
||||
extinfo="iowait irq softirq"
|
||||
fi
|
||||
# shellcheck disable=SC2126
|
||||
|
@ -68,7 +68,7 @@ config_cpu() {
|
|||
}
|
||||
fetch_cpu() {
|
||||
extinfo=""
|
||||
if grep '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat >/dev/null 2>&1; then
|
||||
if grep -q '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat; then
|
||||
extinfo="iowait irq softirq"
|
||||
fi
|
||||
CINFO=$(grep '^cpu ' /proc/stat | cut -c6-)
|
||||
|
|
Loading…
Reference in a new issue