Shell Parsing Process

来源:互联网 发布:在淘宝网买东西可靠吗 编辑:程序博客网 时间:2024/06/05 08:16

1.  Redirection Parse

>, >>, 2>, | , <


2. Command and variable substitution

$var, $(cmd), ${var}


3.  Wildcard expansion   (file name wildcard)

     *, ?, []   

4. Command Execution


example:

ls *  ===>

  1).   *  -expansion ---->     all files 不包括  dot(.)开头的file name;

  2).  ls  ..........filenames......


ls $HOME/*.?  2>/dev/null | tee filelist.txt


Other TIPS: 

1.  2> &1  

2.   所有shell的 通配符,不能匹配  dot(.) 

3.  fc  -l    ---> list all cmd history  ;   fc -e -  n  --> run the cmd from history

 4. kill  PID --> default  send  15 signal ID(Termination signal)  ;   -9 Kill Signal

5. hostname ----> 一个命令

6.  $(cmd)  --> 运行命令, ${cmd}  解引用变量

7.  alias  --- 相反---->  unalias

8. find  选项  --》  

-o   === or ;  

       -type f/d;  

      -size +n(>n) -n(<n) n(==0);  

     -mtime +x(>x days)  (-x) < x

      -perm    777  rxw

     -newer file 

9.  grep      选项

-v  do not match

       -c   count of matching lines

       -l    names of the files

       -n   the number of matching linse in the file

       -i  ignore the case 

       -w  whole word matching

10. sort 选项

       -t delimiter

       +field[.column]     --> field   --> column

11. head & tail

      head -n   --->  开始的几行

      tail -n   ---》  结束开始倒数几行

      tail  +n ----》 文件第n行开始的所有行


   



原创粉丝点击