shell小结(2)
-----------------------------grep -i -w wad * // -w 匹配单词.cshrc文件alias ws "wad start"alias wt "wad stop"------------------------------\< 和 \> 分别标注单词的开始与结尾。 例如: grep man * 会匹配 ‘Batman’、‘manic’、‘man’等, grep '\<man' * 匹配‘manic’和‘man’,但不是‘Batman’, grep '\<man\>' 只匹配‘man’,而不是‘Batman’或‘manic’等其他的字符串。 '^':指匹配的字符串在行首, '$':指匹配的字符串在行尾, ---------------------------重复的处理:tr -s 'a' :压缩重复ftp1204@AIC2:~/.dd> echo 'aiaa' | tr -s 'a'aia比较多个空格,变为一个sort -u 文件 //去重复-----------------------//输出每个参数#!/bin/bashfor i in $* doecho $idone-----------------------//date命令date --date='20091111 10:10:10' +%sdate +%Y%m%d%H%M%S//当前的时分秒date +%Tdate -u +%Y%m%d%H%M%S 世界标准时间//更改用户的shell类型usermod -s /bin/bash ftp1204通配符:* ? [abc] [!ab]echo b{ed,olt,ar}s 和 ls *.{c,h,o} ftp1204@AIC2:~/.dd> echo {a}{a}ftp1204@AIC2:~/.dd> echo {a,}a-------------------------------------bash的默认:source .bash_profile//查看终端类型echo $TERM //查看jobftp1204@AIC2:~/.dd> jobs -l[1]- 23469 停止 (tty 输出) vi test[2]+ 23488 停止 (tty 输出) vi test2[3] 23570 Running tail -f tt.txt &---------------------------------------使用vi删除行尾中的^M 字符:0,$s/\r//g---------------------------------------?