#!/bin/bash echo >&2 "time elapsed in seconds..." START=$(date +%s.%N) # do something ####################### $@ ####################################### END=$(date +%s.%N) DIFF=$(echo "scale=2; (${END} - ${START}) / 1" | bc) echo "${DIFF}"