title: How to include a carriage return in an argument to an executable?
body: <p>I have a simple program that prints out <code>argv</code> character by character, and I want to pass in carriage return (<code>'\r'</code>  or ASCII# 0x0D) as a program argument. How do I achieve this in linux OS (Ubuntu)? I am using bash.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(int argc, char* argv[]) {
      int i;  
  
      for(i = 1; i &lt; argc; i++) {     
          char* curr = argv[i];
          while(*curr != '\0') {
              printf("[%c %x] ", *curr, *curr);
              curr++;
          }
          printf("\n");
      }
      return 0;
  }
  </code></pre>
  
  <p>Assuming our executable program is called <code>test</code>, if the input is :</p>
  
  <pre><code>./test hi
  </code></pre>
  
  <p>Then we get</p>
  
  <pre><code>[h 68] [i 69]
  </code></pre>
  
  <p>Or if I want to print out newline character, I execute program with command :</p>
  
  <pre><code>./test '[Enter Pressed]'
  </code></pre>
  
  <p>Then we get</p>
  
  <pre><code>[
   0a] 
  </code></pre>
  
  <p>What should I type for program argument so that it prints out the carriage return? Or more generally any ASCII character that are not supported by keyboard?</p>