- 论坛徽章:
- 0
|
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 |
|