title: BASH: print output on one line
body: <p>I've got this simple script below to stream compressed MySQL dumps to Amazon S3 bucket in parallel:</p>
  
  <pre><code>#!/bin/bash
  
  COMMIT_COUNT=0
  COMMIT_LIMIT=2
  
  for i in $(cat list.txt); do
  
          echo "$i "
  
          mysqldump -B $i | bzip2 -zc | gof3r put -b s3bucket -k $i.sql.bz2 &amp;
  
  
          (( COMMIT_COUNT++ ))
  
          if [ ${COMMIT_COUNT} -eq ${COMMIT_LIMIT} ]; then
          COMMIT_COUNT=0
          wait
          fi
  
  done
  
  if [ ${COMMIT_COUNT} -gt 0 ]; then
          wait
  fi
  </code></pre>
  
  <p>The output looks like this:</p>
  
  <pre><code>database1 
  database2 
  duration: 2.311823213s
  duration: 2.317370326s
  </code></pre>
  
  <p>Is there a way to print this on one line for each dump?</p>
  
  <pre><code>database1 - duration: 2.311823213s
  database2 - duration: 2.317370326s
  </code></pre>
  
  <p>The <code>echo -n</code> switch doesn't help in this case.</p>
  
  <p><strong>EDIT: Wed May  6 15:17:29 BST 2015</strong></p>
  
  <p>I was able to achieve expected results based on accepted answer:</p>
  
  <pre><code>echo "$i -" $(mysqldump -B $i| bzip2 -zc | gof3r put -b s3bucket -k $i.sql.bz2 2&gt;&amp;1) &amp;
  </code></pre>
  
  <p>- however a command that is running in a subshell is not returning exit status to a parent shell because it's running in parallel so I'm not able to verify if it succeed or failed.</p>