Creating charts for my UPS metrics - Part 2
Quoting - you need double-quotes on the last line: it should be "${API_PARAMS[@]}" (remember that the [@] makes the shell expand it into multiple words, so it won't be seen by your http program as just one).

Instead of if [ "$field" -eq 2 ], it's clearer to compare the field name.  That will help if you change the properties list in future.  It may help to create a variable:

propname="${UPS_PROPS[$index]}"
value=$(/sbin/apcaccess -up "$propname")
if [ "$propname" = LOADPCT ]


We can supply standard input from a string without needing an echo process, by using &lt;&lt;&lt; redirection:

    # bc required for floating point arithmetic
    value=$(&lt;&lt;&lt;"$value * 6" bc)  # 600 Watt * load percent


We can make the array 1-based, and avoid the need to have $field different from $index:

UPS_PROPS=([1]="LINEV" "LOADPCT" "TIMELEFT")