title: how to write a bash script that would get minor and major device numbers of /dev/random
body: <p>I am trying to run a program in a chrooted environment, and it needs <code>/dev/random</code> as a resource.
  Manually I can do <code>ls -l</code> on it and then create the file again with <code>mknod c xx yy</code>, but I need to make it automatic and I don't think these version numbers are constant from a linux version to another so that is why I have the following question :</p>
  
  <p>How could I write a bash script that would extract the minor and major numbers of <code>/dev/random</code> and use it with mknod? I can use <code>ls -l</code> but I don't know how to extract a substring of it...</p>
  
  <p>The exact return of <code>ls -l /dev/random</code> is :</p>
  
  <pre><code>crw-rw-rw- 1 root root MINOR, MAJOR mars  30 19:15 /dev/random
  </code></pre>
  
  <p>and the two numbers I want to extract are MINOR and MAJOR. However if there is an easier way to create the node without ls and mknod I would appreciate it.</p>