shell脚本 显示文件大小 显示运行时间

版权声明:此文章为许诗宇所写,如需转载,请写下转载文章的地址 https://blog.csdn.net/xushiyu1996818/article/details/83147176

显示大小

echo $file
size=`stat -c "%s" $file`

显示运行时间

starttime=`date +'%Y-%m-%d %H:%M:%S'`
endtime=`date +'%Y-%m-%d %H:%M:%S'`
start_seconds=$(date --date="$starttime" +%s);
end_seconds=$(date --date="$endtime" +%s);
echo "本次运行时间:" $((end_seconds-start_seconds))"s";

猜你喜欢

转载自blog.csdn.net/xushiyu1996818/article/details/83147176