But my favorite bash
history substitution is
is a number from 0 to 9.
It means "take arguments
through the last
argument on the previous command line."
Since I tend to use more than one argument with UNIX commands, this
lets me type the arguments (usually filenames) only once.
For example, to use
and make an edit to article files named 1171
for this book, I did:
co -l 1171 6830 2340
RCS/1171,v -> 1171
RCS/2340,v -> 2340
revision 1.8 (locked)
vi 1171 6830 2340
3 files to edit
ci -m"Changed TERM xref." !*
ci -m"Changed TERM xref." 1171 6830 2340
In the first command line (
), I typed the filenames as arguments 2,
3, and 4.
In the second command line (
), I used
that grabbed arguments 2 through the last (in this case, argument 4) from
the first command line.
The result was a second command line that had those three filenames as its
arguments 1, 2, and 3.
So, in the third command line (
), I used
pick arguments 1 through the last from the previous (second) command line.
is shorthand for
You can also grab arguments from previous command lines.
grabs the second through last arguments on
the previous emacs
command line (command line starting with "em").
There are lots more of these in article
If those look complicated, they won't be for long.
Just learn to count to the first argument you want to grab.
It took me years to start using these substitutions - but they've saved me so
much typing that I'm sorry I didn't get started earlier!