Skip to content

Commit b858208

Browse files
committed
filter item keys from -p for valid characters
thanks to asaveljevs for spotting the issue thanks to geirha for providing an elegant solution
1 parent 9bb251a commit b858208

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zabbix_agentd-completion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ _zabbix_agentd()
7878
;;
7979
-@(t|-test))
8080
# get the available item keys (without parameters) from the currently used binary
81-
COMPREPLY=( $(compgen -W "$($1 -p | awk '/\[/ {sub(/\[.*/,"[",$1);print $1}')" -- ${cur}) )
81+
COMPREPLY=( $(compgen -W "$($1 -p | awk '/\[/{ sub(/\[.*/,"["); if ($1 ~ /^[[:alnum:]._-]+\[?$/) print $1}')" -- ${cur}) )
8282
if [[ $COMPREPLY =~ "[" ]]; then
8383
compopt -o nospace
8484
fi

0 commit comments

Comments
 (0)