linux shell编写以日期时间为文件名的脚本

--

#!/bin/sh

a=`date +%Y-%m-%d-%H-%M-%S`
echo $a;


a=`date +%Y-%m-%d-%Hh-%Mm-%Ss`
echo $a;

 

 

#log
MYDATE=`date +%d%m%y`
#append MYDATE to the variable LOGFILE that holds the actual filename of the log
LOGFILE=/root/test_log.$MYDATE
#create the file
>$LOGFILE
MYTIME=`date +%d%R`
LOGFILE2=/root/test_logtime.$MYTIME
#create the file
>$LOGFILE2
 
Last modified onWednesday, 18 September 2013 22:19

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169

Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
back to top