【转】How to append current date and timestamp to filename in shell script
2014-01-27 21:46
471 查看
$ 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
相关文章推荐
- [linux]How to set PATH in shell script, and keep it avaiable even after it exits
- How to format date for display or to use in a shell script
- [quote]HowTo Format Date For Display or Use In a Shell Script
- How to copy and paste quickly in the shell
- [原] XAF How to see and edit the time part in the DatePropertyEditor for the System.DateTime property
- How to Configure Selenium Webdriver in Eclipse and execute some simple test script.
- how to run 2 or more commands in a shell script [for Linux & Windows]
- one command to delete all files with name "filename" in current dir and all its sub-dirs
- How to Create a Secure Login Script in PHP and MySQL
- How to find variable is empty in shell script
- How to get current date time in SharePoint Site Time Zone
- How to find variable is empty in shell script
- How to Create a Secure Login Script in PHP and mySQL
- How to execute shell script in Java?
- How to find and fix Bash Shell-shock vulnerability CVE-2014-6271 in unix like system
- How to execute shell script in Java?
- [quote] How to comment multi-lines in bash shell script.
- How to use ftp in a shell script
- How to get current date in magento?
- How to Display Image In Picturebox in VC++ from Iplimage and Mat