title: How do I prevent my bash script (tailing a file) from repeatedly acting on the same line?
body: <p>I was working on a script that would keep monitoring login to my server or laptop via ssh.</p>
  <p>this was the code that I was working with.</p>
  <pre><code>slackmessenger() {
  curl -X POST -H 'Content-type: application/json' --data '{&quot;text&quot;:&quot;'&quot;$1&quot;'&quot;}' myapilinkwashere 
  ## removed it the api link due to slack restriction
  }
  
  while true
  do
          tail /var/log/auth.log | grep sshd | head -n 1 | while read LREAD
          do
          echo ${LREAD}
          var=$(tail -f /var/log/auth.log | grep sshd | head -n 1)
          slackmessenger &quot;$var&quot;
          done
  done
  
  </code></pre>
  <p>The issue I'm facing is that it keeps sending the old logs due to the while loop. can there be a condition that the loop only sends the new entries/updated enter as opposed to sending the old one over and over again. could not think of a condition that would skip the old entries and only shows old one.</p>