contrib: fix id parsing in IO loop of cowsay.sh plugin

This commit is contained in:
Tony Aldon 2023-07-02 15:30:11 +02:00 committed by Rusty Russell
parent e6d23b5677
commit dae6a0bcf2

View File

@ -31,7 +31,7 @@ echo '{"jsonrpc":"2.0","id":'"$id"',"result":{}}'
# eg. { "jsonrpc" : "2.0", "method" : "cowsay", "id" : 6, "params" :[ "hello"] }
while read -r JSON; do
read -r _
id=$(echo "$JSON" | sed 's/.*"id" *: *\([0-9]*\),.*/\1/')
id=$(echo "$JSON" | sed 's/.*"id" *: *\([^,]*\),.*/\1/')
params=$(echo "$JSON" | sed 's/.*"params" *: *//' | tr -d '[{}]"')
echo '{"jsonrpc":"2.0","id":'"$id"',"result":{"format-hint":"simple","cowsay":"'
# FIXME: lightning-cli does not unescape \\, so we replace with an L.