title: hdiutil working in terminal window but not in shell script
body: <p>I am using using hdiutil to mount a sparseimage file and it works fine when I type the command into terminal but when I try to run it as a shell script it gives a error.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>echo -n 'password' | hdiutil attach -stdinpass file.sparseimage
  </code></pre>
  
  <p>This is the error:</p>
  
  <pre><code>hdiutil: attach failed - Authentication error
  </code></pre>
  
  <p>I am sure that the password is correct. Can anyone tell me what is wrong?</p>