码迷,mamicode.com
首页 > 系统相关 > 详细

Shell 总结

时间:2015-04-01 01:45:32      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

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

Shell 总结

标签:

原文地址:http://www.cnblogs.com/alexweng/p/4382482.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!