IT/Tips

shell readline HowTo

싸후이 2007. 1. 15. 13:45
 
!
Start a history substitution, except when followed by a space, tab, the end of the line, or `='.
!n
Refer to command line n.
!-n
Refer to the command n lines back.
!!
Refer to the previous command. This is a synonym for `!-1'.
!string
Refer to the most recent command starting with string.
!?string[?]
Refer to the most recent command containing string. The trailing `?' may be omitted if the string is followed immediately by a newline.
^string1^string2^
Quick Substitution. Repeat the last command, replacing string1 with string2. Equivalent to !!:s/string1/string2/.
!#
The entire command line typed so far.

!!
designates the preceding command. When you type this, the preceding command is repeated in toto.
!!:$
designates the last argument of the preceding command. This may be shortened to !$.
!fi:2
designates the second argument of the most recent command starting with the letters fi.
Here are the word designators:
0 (zero)
The 0th word. For many applications, this is the command word.
n
The nth word.
^
The first argument; that is, word 1.
$
The last argument.
%
The word matched by the most recent `?string?' search.
x-y
A range of words; `-y' abbreviates `0-y'.
*
All of the words, except the 0th. This is a synonym for `1-$'. It is not an error to use `*' if there is just one word in the event; the empty string is returned in that case.
x*
Abbreviates `x-$'
x-
Abbreviates `x-$' like `x*', but omits the last word.
If a word designator is supplied without an event specification, the previous command is used as the event.

'IT > Tips' 카테고리의 다른 글

diff, patch, cvs  (0) 2007.01.15
Shell programming  (0) 2007.01.15
dynamic Library 적용  (0) 2007.01.15
Linux Bell on_off  (0) 2007.01.15
tcpdump Howto  (0) 2007.01.15