title: Adding quotes to a String in bash script
body: <p>I am trying to add quotes to a string. Like this:</p>
  
  <pre><code>stackoverflow =&gt; 'stackoverflow'
  </code></pre>
  
  <p>And then append this string to another variable separated by a 'comma'. like: </p>
  
  <p><strong>${list} (before appending) => 'stackexchange',.....,'meta'</strong></p>
  
  <p><strong>${list},'stackoverflow' => 'stackexchange',.....,'meta','stackoverflow'</strong></p>
  
  <p>I've tried to do this:</p>
  
  <pre><code>            if [ -z "$partition_list" ]
              then
  
                  partition_list="'"${partition}"'"
              else
  
                  partition_list=${partition_list}",'"${partition}"'"
              fi
  </code></pre>
  
  <p>Note: $partition is the variable that I am trying to add quotes to. And $partition_list is the list I am trying to append $partition to.</p>
  
  <p>It didn't work. I get the strings like this: <strong>''\''10099'\''</strong></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I am getting the value of partition through this statement:</p>
  
  <pre><code>partition=`echo $f | awk -F '=' '{print $2}'`
  </code></pre>
  
  <p>Is there a way we can add 'sed' to this statement and add the quotes to $partition?</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thank you.</p>