title: How can I ignore errors with bash stdin redirection?
body: <p>I want to read a file into a variable. I can do this with a <a href="https://stackoverflow.com/questions/7427262/how-to-read-a-file-into-a-variable-in-shell">stdin redirection operator</a>:</p>
  <pre><code>MYVAR=$(&lt;/some/file)
  </code></pre>
  <p>However, the file is a sysfs node and may error out. I'm also using <code>set -o errtrace</code> and want to ignore the error if it happens, just getting an empty variable. I've tried the following but surprisingly it always gives an empty variable.</p>
  <pre><code>MYVAR=$(&lt;/some/file || true)
  </code></pre>
  <p>Why is it always empty?</p>
  <p>I could use <code>cat</code>:</p>
  <pre><code>MYVAR=$(cat /some/file 2&gt;/dev/null || true)
  </code></pre>
  <p>but would like to know if it's possible without.</p>