Friday, November 07, 2008

BASH - Time Your Bash Script

#!/bin/bash
time_start=`date +%s`
sleep 63
time_end=`date +%s`
time_elapsed=$((time_end - time_start))
echo $(( time_elapsed / 60 ))m $(( time_elapsed % 60 ))s

No comments: