title: Bash sleep in milliseconds
body: <p>I need a timer which will work with milliseconds. I tried to use <code>sleep 0.1</code> command in a script, but I see this error message:</p>
  
  <p><code>syntax error: invalid arithmetic operator (error token is ".1")</code></p>
  
  <p>When I run <code>sleep 0.1</code> in terminal it works fine.</p>
  
  <p>Please help me!</p>
  
  <p>EDIT:
  Sorry I have made a mistake:</p>
  
  <pre><code>function timer
  {
  while [[ 0 -ne $SECS ]]; do
      echo "$SECS.."
      sleep 0.1
      SECS=$[$SECS-0.1]
  done
  }
  </code></pre>
  
  <p>Line <code>sleep 0.1</code> was 5th and <code>SECS=$[$SECS-0.1]</code> was 6th. I just garbled lines. The problem was in 6th line, because bash can't work with float numbers. I changed my function as below:</p>
  
  <pre><code>MS=1000
  function timer
  {
  while [[ 0 -ne $MS ]]; do
      echo "$SECS.."
      sleep 0.1
      MS=$[$MS-100]
  done
  }
  </code></pre>