免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 572 | 回复: 0
打印 上一主题 下一主题

my notes of bash [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-08 18:45 |只看该作者 |倒序浏览
note some fundamental concept down here from some books,and some of my comments and experiments.
1.basic

files:
     tilde ~ expansion
     the wildchar: ?,*,[set],[!set]
     the brace{} expansion
input and output:
    /dev/stdin guess what it is^_^
   and it's my test:
enter "ls /dev/|grep std"
lrwxrwxrwx 1 root root          15 2006-11-09 05:42 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root          15 2006-11-09 05:42 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root          15 2006-11-09 05:42 stdout -> /proc/self/fd/1

so,we can see the the string we type from keyboard is stored in the buffer /proc/self/fd/0(it's just my guess),and similar to the other two.
  file redirection: '' for out
  the pipe:|
if you want to run a job background and don't want to it produce stdout,just redirect the output.
some special char:
  ',"  :quote,and both can quote "return".
  \    :......
  
echo 'Herry'\''s tea party'
guess what's the output?
Herry's tea party
you may conclude something from the above

stty -a to see the combintion key(mainly Ctrl+...)mean.
don't forget the command "help",it's helpful indeed sometimes.
2.Command-Line Editing
  set the editing mode:
    set -o vi|emacs
mostly we are working in the emacs editing mode.

  basic emacs-mode commands:
  C-b,C-f to move back or fore
  C-h,C-d to delete backw or forew
  
  E-b,E-f to move backward of foreward a word
  E-C-h,E-Del to delete a word foreward,
  E-Del seems to have some problem.
  E-d ... backward
  
  C-y   insert what just be deleted
  C-A   Move to beginning of line
  C-E   Move to end of line
  C-K   Kill forward to end of line

edit about the history file:
  C-p
  C-n
  C-r search reverse
  E- last...
  
you possiblely kown tab completion
and there's more about other completion command
  E-?   :list possible choice
  E-Tab :attempt completion from the history list
  the following,prefixed by
  'E-*'     for attempt completion,and
  'C-x,*'   for list possible ..
  / : filename
  ~ : username
  $ : varible
  @ : hostname
  ! : command
  
and other combination key:
  C-j|m|o :ok,when j,linefeed;m,cr;o,lf?cr?and when o,it display next line in command history.
  C-l  :like the command"clear"
  C-t  :change position of chars
  C-u  :kill line
  C-v  :quoted insert(atually i dont kown how to use it)
  C-[  :Same as ESC(so....)
  E-c  :change the char to capital
  E-u  :change the all chars afterpoint to capital
  E-l  :the opposite
  E-.|_ :insert last word in previois command
the vi-mode?no...
the fc commmand:
  fc is a built-in shell command,and see man ,info,help....
Event Designators:
  !,!!,!n,!-n,!string,!?string?  :.....
  ^string1^string2 :last command wite string2 replacing.
  history:  to see the history command
  
Word Designators:(seems to follow Event Designators)
0~n :nth word
^,$ :first or last agument
%   :a word mostly search.
x-y :from x to y
*   :in fact ,1-$
x*  :x to $
x-  :x to $-1
  
Modifiers:
h,r,e,t
  :remove pathname but head/suffix/all but suffix/pathname but tail
  p:print the resulting command but doesn't execute it
  q:quote.. ?
  x:quote.. ?
  s/old/new :substitutes new for old
  
  
readline:
  what's it?
  setupfile: .inputrc(determined by the varible INPUTRC)
             its usage is bind keyname(ro so-call escape sequence) to macro or readline function
  escape sequence:
     \C- :control key prefix
  \M- :Meta
  \e  :escape char
  \\  :\
  \ :double quote char
  \'    :single quote
  


to be contined...


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22769/showart_197427.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP