muninlite: do not crash if empty line is received (#8)

Trivial fix for the following error:

  root@naru:~# echo "" | ./muninlite
  ./muninlite: line 696: do_: not found
  root@naru:~#
This commit is contained in:
Kim B. Heino 2020-10-07 20:08:49 +03:00 committed by GitHub
parent e6f5722a04
commit ebd0cca326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,7 +119,7 @@ do
arg1=$(echo "$arg1" | xargs) arg1=$(echo "$arg1" | xargs)
if ! echo "$FUNCTIONS" | grep -qwF "$arg0"; then if ! echo "$FUNCTIONS" | grep -qwF "$arg0"; then
echo "# Unknown command. Try $(echo "$FUNCTIONS" | sed -e 's/\( [[:alpha:]]\{1,\}\)/,\1/g' -e 's/,\( [[:alpha:]]\{1,\}\)$/ or\1/')" echo "# Unknown command. Try $(echo "$FUNCTIONS" | sed -e 's/\( [[:alpha:]]\{1,\}\)/,\1/g' -e 's/,\( [[:alpha:]]\{1,\}\)$/ or\1/')"
else elif [ -n "$arg0" ]; then
"do_$arg0" "$arg1" "do_$arg0" "$arg1"
fi fi
done done