title: display result along with user info in shell script
body: <p>I written a script which reads 2 files in a for loop and calls utility script. At the end, script will call the consolidated report function to display the output in tabular format.</p>
  
  <p>my problem is  am not able to figure out how to display the results along with the user details one after the another. Any help is most appreciated.</p>
  
  <pre><code>  function runClients {
  
  if [ ! -f $RFILE ]; then
      echo -e "rfile doesn't exits.. pls check!! exiting"
      exit 1
  fi
  for t in ` cat $TFILE ` ; do
    for r in ` cat $RFILE ` ; do
    echo "Running client for token: ${t} on item: {$r}" | tee -a $RESULT_FILE
    ${TESTCLIENT} -f $r -u $t ${TEST_LOG_DIR}/${r}_`date '+%Y%m%d_%H%M%S'`.xml &gt;&gt; $RESULT_FILE
     if [ -s $RESULT_FILE ]; then
        STATUS=${STATUS_OK}
       else
        STATUS=${STATUS_NOK}
     fi
    done
   done
   consolidated_report
   sleep $SLEEPTIME # Assuming it needs at least 30 seconds for test client to complete
  
  }
  </code></pre>
  
  <p>consolidated_report function :</p>
  
  <pre><code>    function consolidated_report () {
    printf "|===========================================================================|\n";
    printf "Displaying SummaryReport\n"
    echo "Executed on Date : " `date  "+%m/%d/%y %H:%M:%S"`
  if [[ -r $RESULT_FILE &amp;&amp; -s $RESULT_FILE  ]]; then
    printf "|==========================================================================|\n"; 
    printf "|              Round Trip Summary                                          |\n"
    printf "|==========================================================================|\n";
    cat $RESULT_FILE
    echo -e "Testcase status :\e[1;32m ${STATUS_OK}\e[0m                                                    "
    printf "|===========================================================================|\n";
  
  fi
  }
  </code></pre>
  
  <p>Currently am getting output like this :</p>
  
  <pre><code>    Running testclient for user: AQIC5wM2LY4SfcxZae% on item: {ffed}
  Running testclient for user: Q3MTkxMDkwOQACUzEAAjA2%23 on item: {rrcw}
  |===========================================================================|
  Displaying SummaryReport
  Executed on Date :  02/17/16 09:39:59
  |==========================================================================|
  |              Round Trip Summary                                          |
  |==========================================================================|
  Number of Connection Count = 1
  Items Requested: 2 Item Retrieval Time: 86 milliseconds.
  Average Round Trip : 65 milliseconds
  Minimum Round Trip : 44 milliseconds for item: ffed
  Maximum Round Trip : 86 milliseconds for item: rrcw
  Item retrieval complete. Exiting.
  Channel: 1 Disconnected application from server.
  Peak Rate: 0.00 Peak Average Update Size: 0
  Number of Connection Count = 1
  Items Requested: 2 Item Retrieval Time: 83 milliseconds.
  Average Round Trip : 62 milliseconds
  Minimum Round Trip : 42 milliseconds for item: ffed
  Maximum Round Trip : 83 milliseconds for item: rrcw
  Item retrieval complete. Exiting.
  Channel: 1 Disconnected application from server.
  Peak Rate: 0.00 Peak Average Update Size: 0
  Testcase status : Passed
  |===========================================================================|
  </code></pre>
  
  <p>I was expecting to get the summary report as :</p>
  
  <pre><code>    |===========================================================================|
  Displaying SummaryReport
  Executed on Date :  02/17/16 09:39:59
  |==========================================================================|
  |              Round Trip Summary                                          |
  |==========================================================================|
  Running testclient for user: AQIC5wM2LY4SfcxZae% on item: {ffed}
  Number of Connection Count = 1
  Items Requested: 2 Item Retrieval Time: 86 milliseconds.
  Average Round Trip : 65 milliseconds
  Minimum Round Trip : 44 milliseconds for item: ffed
  Maximum Round Trip : 86 milliseconds for item: rrcw
  Item retrieval complete. Exiting.
  Channel: 1 Disconnected application from server.
  Peak Rate: 0.00 Peak Average Update Size: 0
  Running testclient for user: Q3MTkxMDkwOQACUzEAAjA2%23 on item: {rrcw}
  Number of Connection Count = 1
  Items Requested: 2 Item Retrieval Time: 83 milliseconds.
  Average Round Trip : 62 milliseconds
  Minimum Round Trip : 42 milliseconds for item: ffed
  Maximum Round Trip : 83 milliseconds for item: rrcw
  Item retrieval complete. Exiting.
  Channel: 1 Disconnected application from server.
  Peak Rate: 0.00 Peak Average Update Size: 0
  Testcase status : Passed
  |===========================================================================|
  </code></pre>