- 论坛徽章:
- 0
|
dazha 发表于 2012-02-15 13:06 ![]()
比方生成 XXXXX.2012.2.24 这么个带日期标志的文件
这个我测试了...没有后缀带时间的文件,
你自己用来测试的touch.sh里面只有一句touch 1.txt,这样当然给touch.sh脚本传任何参数都没影响的了,因为你文件里的touch命令没有去使用传给touch.sh脚本的参数,
例如我有个这样的脚本,在脚本中touch命令使用了传给脚本的参数,不就有效了。
[root@RHEL6A tmp]# cat sh10.sh
#!/bin/sh
if [ $# -gt 0 ]
then
touch --date $1 1.txt
fi
[root@RHEL6A tmp]# ls -lh 1.txt
-rw-r--r-- 1 root root 0 Jan 1 00:00 1.txt
[root@RHEL6A tmp]# ./sh10.sh 20101001
[root@RHEL6A tmp]# ls -lh 1.txt
-rw-r--r-- 1 root root 0 Oct 1 2010 1.txt
[root@RHEL6A tmp]#
上面不是显示出效果了
|
|