title: Redirecting and then moving target file
body: <p>I tested the following on AIX and it works.</p>
  
  <pre><code>logfile=log.txt
  echo "Hello" &gt; "$logfile"
  exec 1&gt;&gt;"$logfile"
  mv "$logfile" "${logfile}_new"
  echo "World"
  </code></pre>
  
  <p>After this script ran the file <code>log.txt_new</code> will contain:</p>
  
  <pre><code>Hello
  World
  </code></pre>
  
  <p>I was not expecting it to work because I renamed the file to where <code>stdout</code> was being redirected. Why does it work?</p>
  
  <p>It also works if I mv/rename the directory that contains the log file.</p>
  
  <p>Answer:
  <a href="https://unix.stackexchange.com/questions/7707/how-do-open-files-behave-on-linux-systems">https://unix.stackexchange.com/questions/7707/how-do-open-files-behave-on-linux-systems</a></p>