大事记:
1.$用法
$()变量替换
#是命令替换,代替前个命令的输出结果,例如:-bash-3.2$ grep "bin" $(ls *.sh ./)
$(())数值运算
``类似于变量替换
#也是命令替换,也可以多层替换,但是移植性不够好,里面的``必须要“\”转义。
${}变量替换--标准的
2.写脚本、录入测试数据,尤其是在复制粘贴(网上的代码)的时候,检查空格、引号问题。
用法:
-bash-3.2$ echo $($(date +%s)/60)
-bash: 1325524371/60: No such file or directory
-bash-3.2$ echo $(($(date +%s)/60))
22092073
-bash-3.2$ echo $(($(date +%s)/60/60/24))
15341
-bash-3.2$
-bash-3.2$ a=1234
-bash-3.2$ echo $a
1234
-bash-3.2$ echo $((($a)+4321))
5555
-bash-3.2$
------------------------------------------------------------------------------------------
字符串相等比较 一般用 =
字符串大于比较 > ( [ ]结构中要转义成\>)
字符串小于比较 < ( [ ]结构中要转义成\<)
模式匹配 ==
正则表达式匹配 =~
整数相等比较 -eq
整数大于 -gt
整数小于 -le
------------------------------------------------------------------------------------------
-bash-3.2$ chage -d yangkai
Usage: chage [options] user
Options:
-d, --lastday LAST_DAY set last password change to LAST_DAY
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-h, --help display this help message and exit
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --list show account aging information
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
-bash-3.2$ chage yangkai -l
Last password change : Aug 08, 2011
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
-bash-3.2$
------------------------------------------------------------------------------------------
光盘挂载之后,是在/media/CentOS_6.0_Final里面,却不是/dev/cdrom
------------------------------------------------------------------------------------------
3.删除无法显示的文件、文件夹
首先:ls -li 找到nodeid
然后:find . -inum 20185200 | xargs rm
4.paste 以列的形式粘贴在文件的后面,paste filea fileb,awk,sed基本无法实现。
5. 磁盘维护--hdparm
6.查看一个网站是不是php写的,点击进去子链接,查看url后缀,如:
阅读(709) | 评论(0) | 转发(0) |