Shell計算時間差功能
Shell計算時間差功能
Shell計算時間差功能,範例如下:
time_take.sh
#!/bin/bash #Filename: time_take.sh start_time=$(date +%s)
./sleep_sec.sh 10
end_time=$(date +%s)
diff__time=$[ $end_time – $start_time ]
printf “\n” printf “Time taken to execute commands is %d (sec)” $diff__time printf “\n” |
參考出處:Linux Shell 腳本攻略 P 21