首页 > 移动平台 > 详细

【转】How to append current date and timestamp to filename in shell script

时间:2014-01-28 00:52:23      阅读:460      评论:0      收藏:0      [点我收藏+]

   $ date +"FORMAT"

 

now=$(date +"%Y-%m-%d-%S")
filename="my_program.$now.log"
# example filename: my_program.2012-01-23-47.log

now=$(date +"%Y.%m.%d.%S.%N")
filename="my_program.$now.log"
# example filename: my_program.2013.01.23.44.364617000.log

now=$(date +"%s")
filename="my_program.$now.log"
# example filename: my_program.1358995092.log

【转】How to append current date and timestamp to filename in shell script

原文:http://www.cnblogs.com/nhlinkin/p/3535239.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!