title: Base64 encoding different in script
body: <p>I'm attempting to base64 encode a user:password string in a bash script, however the results in the script are different than if I run the command in a shell.</p>
  
  <p>In shell (expected output):</p>
  
  <pre><code>echo -n "user:password" | base64
  dXNlcjpwYXNzd29yZA==
  </code></pre>
  
  <p>In script (w/ -n):</p>
  
  <pre><code>USER=$(echo -n "user:password" | base64)
  echo $USER
  LW4gdXNlcjpwYXNzd29yZAo=
  </code></pre>
  
  <p>In script (w/o -n, extra character at end):</p>
  
  <pre><code>USER=$(echo "user:password" | base64)
  echo $USER
  dXNlcjpwYXNzd29yZAo=
  </code></pre>
  
  <p>Can someone tell me what I'm missing here. Thanks</p>