START_TIME=$(date +%s)

sleep 1

END_TIME=$(date +%s)

echo "It took $(($END_TIME - $START_TIME)) seconds to sleep of 1 second..."

linux shell 스크립트에서 경과 시간을 측정하고 싶을 때는 date 명령을 이용하면 된다.

참고 : https://code-maven.com/measure-elapsed-time-in-shell

 

Measure elapsed time in Linux shell using time and date

 

code-maven.com

 

728x90

+ Recent posts