linux shell计时程序
不多说,直接给出代码。
#!/bin/bash start=$(date "+%s") #do something sleep 2 now=$(date "+%s") time=$((now-start)) echo "time used:$time seconds"
最后给出的数值是以秒为单位。
不多说,直接给出代码。
#!/bin/bash start=$(date "+%s") #do something sleep 2 now=$(date "+%s") time=$((now-start)) echo "time used:$time seconds"
最后给出的数值是以秒为单位。