1. 检查一组代码从执行开始到执行完毕的时间。

#!/bin/bash
start=$(date +%s)
commands;
statements;

end=$(date +%s)
difference=$(( end - start ))
echo Time taken to execute commands is $difference seconds.