title: How to use printf "%q " in bash?
body: <p>I would like to print out augments of a function to a file.
  I was told a command <code>printf &quot;%q &quot;</code>, whose instruction is following,</p>
  <pre><code># man printf
  %q     ARGUMENT is printed in a format that can be reused as shell input, escaping non-print‐
            able characters with the proposed POSIX $'' syntax.
  </code></pre>
  <p>On the basis of instruction above, I tried following code.</p>
  <pre><code>#!/bin/bash
  # file name : print_out_function_augs.sh
  
  output_file='output.txt'
  
  function print_augs() {
    printf &quot;%q &quot; &quot;$@&quot; &gt;&gt; &quot;${output_file}&quot;
    echo &gt;&gt; &quot;${output_file}&quot;
  }
  
  print_augs a 'b c'
  
  cat &quot;${output_file}&quot;
  rm &quot;${output_file}&quot;
  </code></pre>
  <p>and run</p>
  <pre><code>bash print_out_function_augs.sh
  </code></pre>
  <p>The results are following,</p>
  <pre><code>a b\ c
  </code></pre>
  <p>I expected the results as</p>
  <pre><code>a 'b c'
  </code></pre>
  <p>which is the original augments to print_augs function.</p>
  <p>Why does the output and the original augments are different?
  Or can I print out the original augments as they are?</p>
  <p>Thank you very much.</p>