Shell 总结
find: –name ‘filenme’ * ? [] ; –iname; –regex PATTERN; –user username; –group; –uid; –gid; –nouser; nogroup;-type; –size; –mtime; –ctime; –atime;-perm mode; –perm –mode; –perm /mode
Regex: .; *; \?; ^; $; ^$; \<; \>; \b; “\(l..e\).*\1r”; [^]; [a-zA-Z0-9]; [:space:]; [:punct:][:lower:][:upper:][:alpha:][:digit:][:alnum:]; +; {m,n}; “(C|c)at”; grep –I –-color –v –o;
列表:{0..100}; seq 2 2 10; `ls /etc`;
Man:8章节;格式:[];|;<>;…;Name;Synopsis;Desc;Options;Files;Bugs;Examples;操作:space,b,回车,k,/keyword,?keyword,n/N;
字符:|; 0; 1; 2; >; >>; <; <<; set –C; set +C; &>; cmd [] [] << EOF >EOF; cat –n|-E; tac; less; man; tail; head; cut –d: f1 filename; tr ‘ab’ ‘AB’; sort –t: –k3 –n –r /etc/passwd|cut –d: –f3; –f; –u; uniq –d, –D, –c; wc –l,-w,-c,-m,-L;
特殊变量:$#; $0; $1; $2; $@; $*; $$; $?
CMDS:whatis; type; which;date; clock; hwclock –s,-w; ls –i ; ctrl +z; cmd [] arg1 arg2 … &; bg; jobs; fg jobid; cp S(source)1 S2 … target: –p,-P,-R/-r, –f, –L; mv –t target S1 S2 …; install source… target
~; –; {}; ``;${}; “”;’’; \;
cmd line: ctrl +a,+e,+k,+u, –>; <—;!; !n;!!;!;alias cmd=’’;
文件名通配:*; ?; [:alnum:];[[:alnum:]];
条件判断:整数:[ $A –eq $B ]: eq,ne,gt,lt,ge,le 文件: [ –e file]:efdrwx;字符串:[ $A == $B ][ $A != $B ];
字符运算:$A=”a”,$B=”b”, $A+$B=a+b
算术运算:let c = $A + $B; c=$[$A+$B]; c=$(($A+$B)); c=`expr $A+$B`
选择结构:case SWITCH IN 回车value1)回车statement … ;;回车 value2)回车statement … ;;回车 *)回车statement …;;esca回车||| if condition; then 回车statement…回车 elseif condition; then 回车statement… 回车else回车statement回车fi回车。
循环结构:for 变量 in 列表; do回车 循环体 回车 done; while 条件;do回车 循环体 回车 done
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。