title: Permission denied when piping to a file
body: <p>I'm trying to pipe the output of a "git pull" command to both a file and stdout using the following script:</p>
  
  <pre><code>STD_OUT=`mktemp`
  git pull | $STD_OUT
  rm -f $STD_OUT
  </code></pre>
  
  <p>This results in:</p>
  
  <pre><code>./test.sh: line 2: /tmp/tmp.BITQRbsMSI: Permission denied
  error: git-pull died of signal 13
  </code></pre>
  
  <p>Why am I denied permission to the temp file I just created and what's the alternative?</p>