shell/bash 脚本计时

#!/usr/bin/env bash

startAt=`date +%s`

sleep 3

endAt=`date +%s`

time=$(($endAt - $startAt))
time=`expr $time`
echo $time