Actually found a
far better way to do it directly from Linux script using curl:
curl --silent --user user:pass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://<wallet_IP>:<rpc_port>/ | ./jq '.result | .difficulty')
The output is then piped to jq (a json parser) and the difficulty values extracted ^_^
Hope someone else finds that useful