用时: #!/bin/bash info=`date` start=$(date "+%s") sleep 2 now=$(date "+%s") time=$((now-start)) echo "$info time used:$time seconds" 输入时间参数判定 #!/bin/sh source ~/.bashrc the_day=`date +%Y%m%d -d"yesterday"` if [ $# -eq 1 ]; then the_day=$1 fi echo $the_day year=`date +%Y -d"$the_day"` month=`date +%m -d"$the_day"` day=`date +%d -d"$the_day"` echo $year echo $month echo $day |
|
来自: 520jefferson > 《硬件/虚拟机/linux》