Skip to content

Non-string variables returned as "strings" - part deux! #540

Closed
@pb66

Description

#273

When using the feed api to return the last value it is returned as a string eg "2222", I have been using a bash script to interact with emoncms and found the api call results are causing issues.eg

RESULT=$(curl -s "http://myemoncmsserver.com/feed/value.json?id=123&apikey=abc..123")
echo $((RESULT+2))

returns

-bash: "2222": syntax error: operand expected (error token is ""2222"")

Where as

RESULT="2222"
echo $((RESULT+2))

returns 2224 (as does setting RESULT=2222 without any quotes), the "included" quotes prevent the result being seen as numeric and then the quotes are accepted as part of the string resulting in double quotes.

Since the api is calling the last VALUE shouldn't that be numeric (or null) not a string???

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions