Shell中的变量使用小结
变量的定义,只能以字母和下划线开始,区分大小写,可以包含数字字母下划线.详见官方手册
[root@svnshell_example]#yourname='Linux' [root@svnshell_example]#echo$yourname Linux [root@svnshell_example]#YourName="linux" [root@svnshell_example]#echo"Thevariableis$YourName" Thevariableislinux
获取当前日期的脚本,常用在日志切割中,为了区分每天的日志文件
如下 生成2015年4月27日
[root@svnshell_example]#echo`date+%Y%m%d` 20150427 [root@svnshell_example]#cattoday.sh #!/bin/bash
TODAY=`date+%A` YEAR=`date+%Y年%m月%d日` echo"今天是$YEAR,$TODAY"
[root@svnshell_example]#shtoday.sh 今天是2015年04月27日,星期一
热门推荐
10 圣诞祝福语简短小学
11 祖国七十华诞简短祝福语
12 老师送的祝福语简短
13 生日祝福语大全女生简短
14 祝女性生日祝福语简短
15 牛年女神节祝福语简短
16 情人表白祝福语简短大气
17 老公开业祝福语简短
18 官宣新年祝福语简短