Skip to content

Commit

Permalink
* Removed second method from script to keep the method which only put…
Browse files Browse the repository at this point in the history
… variables with a space in between quotes
  • Loading branch information
blackcobra1973 committed Aug 22, 2014
1 parent 09b6a33 commit 0ee4bb5
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/zabbix/cvpoller-zabbix
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ whitespace="[[:space:]]"
_args=''

### Process variables with spaces in
#for i in "$@"
#do
# if [[ $i =~ $whitespace ]]
# then
# _args="${_args} \"$i\""
# else
# _args="${_args} $i"
# fi
#done
for i in "$@"
do
if [[ $i =~ $whitespace ]]
then
_args="${_args} \"$i\""
else
_args="${_args} $i"
fi
done

for i in "$@";do
_args="$_args \"${i//\"/\\\"}\""
done;

#_args="$@"
#_property_name=`echo ${_args} | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'`
_property_name=`echo $@ | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'`
_property_name=`echo ${_args} | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'`

# Rename property as it might contain dots in the complete property name, so that 'jq' can parse it
sh -c "vpoller-cclient ${_args} 2>/dev/null" | jq -r ".result[0] | {\"property\": .[\"${_property_name}\"]}.property"

0 comments on commit 0ee4bb5

Please sign in to comment.