linux using a summary (update ...)

1, acquisition program running time -linux shell script

1 #!/bin/bash
2 
3 start=$(date +%s)
4 
5 sleep 5;
6 
7 end=$(date +%s)
8 take=$(( end - start ))
9 echo Time taken to execute commands is ${take} seconds.

among them:

  • date +%sGetting the current era (Unix time), that is at 0:00 on January 1, 1970 the number of seconds elapsed from 0 seconds from Coordinated Universal Time (UTC).
  • sleep 5The program delay 5 seconds.
  • take=$(( end - start ))This program calculate the number of seconds elapsed between the beginning and the end.

 

Transfer: https://www.jianshu.com/p/69d6a787aa93

 

Guess you like

Origin www.cnblogs.com/xuelisheng/p/12329845.html