title: How to pass jq values to a variable in linux bash script
body: <p>Can someone please help me out?</p>
  
  <p>I am working on a raspberry pi project and i wanted to control my pins from the cloud. I have this bash script that connects to a web service periodically to check this response. {"status":1,"pin":4}</p>
  
  <p>I am using jq and i was able to get the values that i need using<br /></p>
  
  <pre><code>source gpio
  
  foo = $(curl '{webservice_url}')
  echo ${foo} | jq '.status'
  echo ${foo} | jq '.pin'
  </code></pre>
  
  <hr>
  
  <p>output : 1 and 4</p>
  
  <p>problem is when i try to pass the value to a variable and use them it doesn't work</p>
  
  <p>i tried:</p>
  
  <pre><code> foo = $(curl '{webservice_url}')
   status = `${foo} | jq '.status'`
   pin = `${foo} | jq '.pin'`
  
   echo "$status"
   echo "$pin"
  </code></pre>
  
  <p>I tried using echo ${status} and still
  the error says <br />
    status: command not found <br />
    pin: command not found</p>
  
  <p>also i tried</p>
  
  <pre><code>source gpio
  while true; do
     foo = $(curl '{webservice_url}')
     gpio mode "${foo} | jq '.pin'" out
     gpio write "${foo} | jq '.status'" 1 
     sleep 1
  done
  </code></pre>
  
  <p>but its not working.</p>
  
  <p>Thank you in advance</p>