title: How to parse output from a kubectl command into an array for a bash script
body: <p>I have this kubectl command which gives me the following output. I need to know how to store the output in an array, so I can loop through each of those and further issue gcloud commands on the resources. </p>
  
  <pre><code>kubectl get ingress test-load-balancer -o jsonpath='{.metadata.annotations.ingress\.kubernetes\.io/backends}'| jq  -r 'keys'
  
  [
    "k8s-be-30423--12305b0f030d5a48",
    "k8s-be-31245--10023b0f030d5a48"
  ]
  </code></pre>
  
  <p>However, now I need to run individual commands for these k8s-xx resources inside a bash script. I tried the following but it doesn't save the output in an array</p>
  
  <pre><code>read BACKEND_SERVICES&lt;&lt;&lt;$(kubectl get ingress cysiv-load-balancer -o \
  
  jsonpath='{.metadata.annotations.ingress\.kubernetes\.io/backends}'| jq -r 'keys')
  </code></pre>
  
  <p>Thank you in advance</p>