I have a CURL on my sh script. I need save it`s ddecoded ata.
curl -H "Content-Type: application/json" -X POST -d '{"hash":"$restearterHash"}' {$host}ApiController/jsonRestarter/ | python -m json.tool
how to save data in the varible?
I have a CURL on my sh script. I need save it`s ddecoded ata.
curl -H "Content-Type: application/json" -X POST -d '{"hash":"$restearterHash"}' {$host}ApiController/jsonRestarter/ | python -m json.tool
how to save data in the varible?
You can store the output of a command like this: var=`command`
,
so this should work fine for you:
json=`curl -H "Content-Type: application/json" -X POST -d '{"hash":"$restearterHash"}' {$host}ApiController/jsonRestarter/ | python -m json.tool`
You could use command substitution:
VAR=$(curl -H "Content-Type: application/json" -X POST -d '{"hash":"$restearterHash"}' {$host}ApiController/jsonRestarter/ | python -m json.tool)
echo "${VAR}"