title: BASH printf array with field separator and newline on last entry
body: <p>How can I print out an array in BASH with a field separator between each value and a newline at the end.</p>
  
  <p>The closest I can get with a single printf is <code>printf '%s|' "${arr1[@]}"</code> where | is the field separator.  The problem with this is there is no line break at the end. Any combination of \n I try to put in there either puts in a line break on every entry or none at all!</p>
  
  <p>Is there a way of doing it on one line or do I need to use <code>printf '%s|' "${arr1[@]}";printf "\n"</code></p>
  
  <p>Thanks,</p>
  
  <p>Geraint</p>