Using the time command, as others have suggested, is a good idea.
Another option is to use the magic built-in variable $SECONDS, which contains the number of seconds since the script started executing. You can say:
START_TIME=$SECONDS
dosomething
ELAPSED_TIME=$(($SECONDS - $START_TIME))
I think this is bash-specific, but since you're on Linux, I assume you're using bash.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…