title: Linux command piping in openssl to use string input
body: <p>I have a shell script where a file path <code>$path</code> have some text which I encrypt as below and it works:</p>
  <p><code>content_sha256=&quot;$(openssl dgst -binary -sha256 &lt; $path | openssl enc -e -base64)&quot;;</code></p>
  <p>The value of variable <code>content_sha256</code> works correctly.</p>
  <p>Now, I have a string <code>$body</code> which I want to encrypt. I am trying below but it gives me entirely different result.</p>
  <p><code>content_sha256=&quot;$(echo $body | openssl dgst -sha256 | openssl enc -e -base64)&quot;;</code></p>
  <p>Am I piping something wrong or option for <code>openssl</code> should be different?</p>