-
0 (the number zero)
-
The first word of the event (i.e. the command)
-
n
-
The N'th word of the event
-
^
-
The first argument of the event
-
$
-
The last argument of the event
-
%
-
The word matched by the accompanying!?? search
-
n-m
-
The n'th word to the m'th word of the event
-
*
-
All arguments of the event
-
n*
-
the n'th though the last argument
-
n-
-
the n'th though the second to last argument
-
#
-
The current command and arguments typed so far
Designators are used following a selector and a colon. The colon may be
left out if the designator is not a number. After the shell substitutes
the appropriate events, specifiers, and designators, the event is then
put on the history list, in it's completed form.
When using a designator, you can refer to the last command simply as
a !, or when using a #, referring to the current command (i.e. !#).
For our examples, suppose we just executed the command:
cp chapter1 chapter2 chapter3 chapter5 ~/private/docs/personal/manuscript
"!:0 chapter4 !$" nicely expands to cp chapter4
~/private/docs/personal/manuscript
"ls !?ter1?:1-4" searches for an event using the string ter1 (as in
chapter1), and finds our initial copy event, then 1-4 picks out the first
through fourth words of the event, yielding: ls chapter1 chapter2 chapter3
chapter5
"rm !* !cp:1" expands to rm chapter1 chapter2 chapter3 chapter5 chapter4
"ls !?man?:%" expands to: ls ~/private/docs/personal/manuscript
"echo no !#:0" expands to: echo no echo
|