title: While using printf how to escape special characters in shell script?
body: <p>I am trying to format a string with <code>printf</code> in shell, i will get input string from a file , that have special characters like <code>%,',"",,\user, \tan</code> etc.</p>
  
  <p>How to escape the special characters that are in the input string ?</p>
  
  <p>Eg</p>
  
  <pre><code>#!/bin/bash
  # 
  
  string='';
  function GET_LINES() {
  
     string+="The path to K:\Users\ca, this is good";
     string+="\n";
     string+="The second line";
     string+="\t";
     string+="123"
     string+="\n";
     string+="It also has to be 100% nice than %99";
  
     printf "$string";
  
  }
  
  GET_LINES;
  </code></pre>
  
  <p>i am expecting this will print in the format i want like</p>
  
  <pre><code>The path to K:\Users\ca, this is good
  The second line   123
  It also has to be 100% nice than %99
  </code></pre>
  
  <p>But its giving unexpected out puts</p>
  
  <pre><code>./script: line 14: printf: missing unicode digit for \U
  The path to K:\Users\ca, this is good
  The second line 123
  ./script: line 14: printf: `%99': missing format character
  It also has to be 100ice than 
  </code></pre>
  
  <p>So how can i get rid of the special characters while printing.? <code>echo -e</code> also has the issue.</p>