title: Fish Shell | Command Substitution using curl and JSON for variable assignment
body: <p>I cannot find any doc for Fish Shell regarding using Command Substitution more than once.</p>
  <p>I'm trying to assign the state, city from the JSON result set (jq parser) piped from a curl API query of LocationIQ.  2 Command Substitution 1:(curl) and 2:(jq).  I don't need the location variable assignment if I can get the address variable assignment</p>
  <p>Purpose of Function:
  #Take 2 arguments (Latitude, Longitude) and return 2 variables $State, $City</p>
  <p><strong>The JSON:</strong></p>
  <pre><code>{
    &quot;address&quot;: {
      &quot;city&quot;: &quot;Aurora&quot;,
      &quot;country&quot;: &quot;United States of America&quot;,
      &quot;country_code&quot;: &quot;us&quot;,
      &quot;county&quot;: &quot;Kane County&quot;,
      &quot;postcode&quot;: &quot;60504&quot;,
      &quot;road&quot;: &quot;Ridge Road&quot;,
      &quot;state&quot;: &quot;Illinois&quot;
    },
    &quot;boundingbox&quot;: [
      &quot;41.729347&quot;,
      &quot;41.730247&quot;,
      &quot;-88.264466&quot;,
      &quot;-88.261979&quot;
    ],
    &quot;display_name&quot;: &quot;Ridge Road, Aurora, Kane County, Illinois, 60504, USA&quot;,
    &quot;importance&quot;: 0.2,
    &quot;lat&quot;: &quot;41.729476&quot;,
    &quot;licence&quot;: &quot;https://locationiq.com/attribution&quot;,
    &quot;lon&quot;: &quot;-88.263423&quot;,
    &quot;place_id&quot;: &quot;333878957973&quot;
  }
  </code></pre>
  <p><strong>My Function:</strong></p>
  <pre><code>function getLocation            
     set key 'hidden'
     set exifLat $argv[1]
     set exifLon $argv[2]
     set location (curl -s &quot;https://us1.locationiq.com/v1/reverse.phpkey=$key&amp;lat=$exifLat&amp;lon=$exifLon&amp;format=json&quot; | set address (jq --raw-output  '.address.state,.address.city') )
     
     echo &quot;Location: $location
     echo &quot;state:    $address[1]&quot;
     echo &quot;city:     $address[2]&quot;
  end
  </code></pre>
  <blockquote>
  <p><strong>Error</strong>: fish Command substitution not allowed</p>
  </blockquote>
  <p>Works fine using only the curl Command substitution -&gt;removing the: set address &amp; parens for jq.</p>
  <pre><code>set location (curl -s &quot;https://us1.locationiq.com/v1/reverse.phpkey=$key&amp;lat=$exifLat&amp;lon=$exifLon&amp;format=json&quot; | jq --raw-output  '.address.state,.address.city')
  </code></pre>
  <p>I'm still pretty novice - maybe there is a better way to achieve my desired result: Assign the JSON State to a variable and City to a variable?</p>
  <p>I originally tried (slicing the location[17] - City, location[19] - State) and getting inconsistent results as the fields seem to be dynamic and affecting how many results which affects the ordering.</p>
  <p>Any help appreciated!</p>