title: Overwrite file with last 4 lines using tail to make a log
body: <p>Hi I'm trying to make a bash script that writes messages to a .plan file. I want to keep the file limited to five rows. So far I've tried to use the tail command in bash.</p>
  
  <pre><code>if [ $(cat .plan | wc -l) -eq 5 ]; then
      tail -n 4 .plan &gt; .plan
  fi
  </code></pre>
  
  <p>However, this just overwrites the file and enters one line instead of four.</p>