title: bash redirect output of command to file appended with space separator
body: <p>I'm running a large loop that calls a program that outputs a single value. I would like to redirect that output to a text file appended by a space rather than a new line. Is there any way to do this? </p>
  
  <pre><code>for i in {1..1000000000}; do
      mincstats file${i}.mnc -mean -quiet &gt;&gt; output.txt
  done
  </code></pre>
  
  <p>I have tried assigning the output to a variable as below, but I think this may be taking up unnecessary processing time. What would be the most efficient way to do this? </p>
  
  <pre><code>for i in {1..1000000000}; do
      var=$(mincstats file${i}.mnc -mean -quiet)
      echo -n $var &gt;&gt; output.txt
  done
  </code></pre>