Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Substitution



On Sun, 17 Apr 2005 18:32:56 +0530,  wrote:

>Hi,
>Suppose I've typed these commands:
>
># mv somefile1 /home/saket/stuff/books/
># acroread somefile.pdf
># mv somefile2 /home/saket/stuff/books/
>
>How can I substitute the '/home/saket/stuff/books/' of the first command 
>into the last command ?
>Currently I just retype it again :(

We all want this but you have eat a little bit if syntax pie!

Scrolling back in history (ESC) (Uparrow) and then reditting that line is the perhaps the easiest
way.
However

> mv !?saket<TAB>
Would bring up the whole line ready for a little editting

or purist

> mv !?saket?:*<tab>
Would just bring up the parameters

If you know the history number of the line (say 5) with desired parameters you can try

> !5:s/somefile1/somefile2/

and if you don't know the history number

!?saket?:s/somefile1/somefile2/

Have I missed anything? (I surely have!)




Messages sorted by: Reverse Date, Date, Thread, Author