title: Unsolved Syntax Error in Bash Function
body: <p>I'm writing a script for a Raspberry Pi that I had working a few days ago, but now seems to have died once I added some additional code. I've attempted to resuscitate, but I'm coming up short. I am getting "Syntax error near unexpected token `done". I've researched it, but I'm not getting anywhere. dos2unix doesn't help (especially since I've coded the entirety of this on Debian 8.) and cat -v doesn't turn up anything. Offending module is as follows:</p>
  
  <pre><code>    24Monitor() {
  
          clear
  echo "Beginning speed tests and traceroutes now. You can just... go do whatever it is you do."
          while [ $SECONDS -lt $end ]; do
                  TestNum=$(($TestNum+1))
                  echo "Speedtest Result #" $TestNum &gt;&gt; ~/speedtest.log
  curl -s  https://raw.githubusercontent.com/sive/speedtest-cli/master/speedtest.py | python -
                  cat ~/tmp.log | sed -e "s/^/$(date -R) /" &gt;&gt; ~/speedtest.log
                  echo ""  &gt;&gt; ~/speedtest.log
                  traceroute mayernetworks.com &gt; ~/traceroutes.log
          done
  
          }
  </code></pre>
  
  <p>I would appreciate any and all insight, as I'm still growing in my scripting knowledge...</p>
  
  <p>EDIT: Variable initilization by request:</p>
  
  <pre><code>end=$((SECONDS+86400))
  </code></pre>