title: Bash building string
body: <p>I have the following code:</p>
  
  <pre><code>streams=("CI" "UI" "QA")
  role_text="streams:read:"
  result=""
  
  for s in "${streams[@]}"
  do
     STREAMID=$(curl -s -u $user:$pass  -X GET -H "Content-Type: application/json" ${GRAYLOG2_URL}/streams | python /opt/script.py $s)
     curl -s -u $user:$pass -X POST -H "Content-Type: application/json" ${GRAYLOG2_URL}/streams/${STREAMID}/resume &gt; /dev/null
     result=$result$role_text$STREAMID,
     echo "result: "$result
  done
  
  final_result=$(echo $result | sed '$s/.$//')
  ROLES=$(curl -u $user:$pass -X GET -H "Content-Type: application/json" ${GRAYLOG2_URL}/roles 2&gt;/dev/null)
  echo "Final result: "$final_result
  GRAYLOG2_ROLE='
  {
    "name" : "'$role'",
    "description" : "'${role}' role",
    "permissions" : [ "'${final_result}'" ],
    "read_only" : false
  }'
  </code></pre>
  
  <p><code>${final_result}</code> should be a string like:</p>
  
  <pre><code>"streams:read:582e0b99b9d3230d808cc0d0", "streams:read:582e0b99b9d3230d808cc0d4", "streams:read:582e0b98b9d3230d808cc0cb"
  </code></pre>
  
  <p>Instead, the result I get is:</p>
  
  <pre><code>"streams:read:582e0b98b9d3230d808cc0cb,streams:read:582e0b99b9d3230d808cc0d0,streams:read:582e0b99b9d3230d808cc0d4"
  </code></pre>
  
  <p>Which obviously, is not working as it should.</p>
  
  <p>Can anyone tell me how do I get to the needed result?</p>
  
  <p>Thank you very much,
  Gabriel</p>