日期:2014-05-16 浏览次数:20944 次
ts=`date "+%Y%m%d%H"`
mv A.xml A_${ts}.xml
------解决方案--------------------
[root@RHEL6A scripts]# more s3.sh
hname=`hostname`
echo $hname
vartime=`date +%Y%m%d%H`
echo $vartime
filesrc='/etc/inittab'
filedest='/root/'$hname'/inittab_'$vartime'.xml'
echo $filesrc
echo $filedest
cp $filesrc $filedest
[root@RHEL6A scripts]# ls /etc/inittab
/etc/inittab
[root@RHEL6A scripts]# ls /root/RHEL6A/
[root@RHEL6A scripts]# ./s3.sh
RHEL6A
2011111810
/etc/inittab
/root/RHEL6A/inittab_2011111810.xml
[root@RHEL6A scripts]# ls /root/RHEL6A/
inittab_2011111810.xml
[root@RHEL6A scripts]#