title: Bash script to calculate time elapsed
body: <p>I am writing a script in bash to calculate the time elapsed for the execution of my commands, consider:</p>
  
  <pre><code>STARTTIME=$(date +%s)
  #command block that takes time to complete...
  #........
  ENDTIME=$(date +%s)
  echo "It takes $($ENDTIME - $STARTTIME) seconds to complete this task..."
  </code></pre>
  
  <p>I guess my logic is correct however I end up with the following print out:</p>
  
  <p>"It takes seconds to complete this task..."</p>
  
  <p>Anything wrong with my string evaluation?</p>
  
  <p>I believe bash variables are untyped, I would love if there is a "string to integer" method in bash nevertheless.</p>