mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-12-21 21:32:13 +01:00
fix: do not interprete leading hyphens in commands as "echo" arguments
Previously an input token with a leading hyphen (e.g. "-n") could be inadvertently interpreted by "echo" instead of being taken literally. No further damage was possible, but this would have been unexpected.
This commit is contained in:
parent
1f147fcb1c
commit
32d4362888
1 changed files with 3 additions and 3 deletions
|
@ -125,9 +125,9 @@ HOSTNAME=$( { hostname -f || hostname || cat /proc/sys/kernel/hostname || echo "
|
|||
echo "# munin node at $HOSTNAME"
|
||||
while read -r arg0 arg1
|
||||
do
|
||||
arg0=$(echo "$arg0" | xargs)
|
||||
arg1=$(echo "$arg1" | xargs)
|
||||
if ! echo "$FUNCTIONS" | grep -qwF "$arg0"; then
|
||||
arg0=$(printf '%s\n' "$arg0" | xargs)
|
||||
arg1=$(printf '%s\n' "$arg1" | xargs)
|
||||
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/')"
|
||||
elif [ -n "$arg0" ]; then
|
||||
"do_$arg0" "$arg1"
|
||||
|
|
Loading…
Reference in a new issue