##SECONDS记录的是这个脚本运行的时间 #!/bin/bash count=1 MAX=5 while [[ "$SECONDS" -le "$MAX" ]] do echo "this is the $count time to sleep" let "count=$count+1" sleep 2 done echo "The running time of this scripts is $SECONDS" [[email protected] shell]# ./runsec.sh this is the 1 time to sleep this is the 2 time to sleep this is the 3 time to sleep The running time of this scripts is 6
SECONDS内部变量-脚本运行的时间
时间: 2024-11-09 03:05:32