title: Concat array elements with comma and single quote - Bash
body: <p>How to convert array elements with single quotes and comma in Bash.</p>
  
  <pre><code>arr=("element1" "element2" "element3")
  #element1 element2 element3
  </code></pre>
  
  <p><strong>Desired result</strong>
  <code>'element1','element2','element3'</code></p>
  
  <p>From <a href="https://stackoverflow.com/a/1527146/5811973">Martin Clayton</a> answer comma seprated values are achieved using <a href="https://unix.stackexchange.com/a/184867/247144">IFS</a>, </p>
  
  <pre><code>SAVE_IFS="$IFS"
  IFS=","
  ARRJOIN="${arr[*]}"
  IFS="$SAVE_IFS"
  
  echo "$ARRJOIN"
  #element1,element2,element3
  </code></pre>
  
  <p>But how to add single quotes to each element.    </p>