Skip to content

Instantly share code, notes, and snippets.

@lambdaydoty
Last active December 25, 2019 03:31
Show Gist options
  • Save lambdaydoty/36e5fb2f285c992b8c12ec8b5d3a2e1e to your computer and use it in GitHub Desktop.
Save lambdaydoty/36e5fb2f285c992b8c12ec8b5d3a2e1e to your computer and use it in GitHub Desktop.
bash-heredoc-curl-password
#!/bin/bash
user=
pass=""
host_port=127.0.0.1:8332
echo password...
read -s pass
while true; do
echo $(curl "http://$user:$pass@$host_port" \
--silent \
--header 'Content-Type: text/plain;' \
--data-binary @- <<- EOF
{
"jsonrpc": "1.0",
"id": "",
"method": "getblockcount",
"params": []
}
EOF
) | jq '.result'
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment