title: redirecting an output of command to /proc
body: <p>I have created a kernel module to have a proc file into which I can read and write data. After using <code>insmod mymodule.ko</code>, I am able to write simple text into my proc file as:</p>
  
  <pre><code>echo "Hello world" &gt; /proc/myprocfile
  </code></pre>
  
  <p>I am also able to read data from my proc file properly using:</p>
  
  <pre><code>cat /proc/myprocfile
  </code></pre>
  
  <p>My question is if I want to write the contents of a command say, <code>ls /proc</code> rather than simply echoing a message, then how to send the output of such command to <code>myprocfile</code>.</p>