title: Calculte checksum of file located in an cpio archive
body: <p>I have a kernel file located inside a cpio archive and I would like to calculate it's sha256sum. 
  For that I redirected the archive output to the standard output and piped through <code>sha256sum</code>. 
  I get the sum by using <code>awk</code>.</p>
  
  <p><code>KERNEL_CHECKSUM=$(cpio --to-stdout -i kernel.fat16 &lt; archive.cpio  | sha256sum | awk '{print $1}')</code></p>
  
  <p>This command works when it runs on a terminal. When run as a script, the checksum is not correctly calculated. </p>
  
  <p>I suspect something related with the standard output but was unable to find the issue.</p>