Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: History expansion to rerun multiple contiguous commands?
- X-seq: zsh-users 13067
- From: Paul Lew <paullew@xxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: History expansion to rerun multiple contiguous commands?
- Date: Thu, 24 Jul 2008 09:54:33 -0700
- Authentication-results: sj-dkim-2; header.From=paullew@xxxxxxxxx; dkim=pass ( sig from cisco.com/sjdkim2002 verified; );
- Cc: Zsh users list <zsh-users@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; l=1301; t=1216918474; x=1217782474; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=paullew@xxxxxxxxx; z=From:=20Paul=20Lew=20<paullew@xxxxxxxxx> |Subject:=20Re=3A=20History=20expansion=20to=20rerun=20mult iple=20contiguous=20commands? |Sender:=20; bh=DZy/386lN+FOsvWgWnpLhgVsKfZTzEuVrXLdXslDhmI=; b=YF+1IEzgqRaHj3+gDSz8HLhQO0Hf0rqheNypwFGweQEqeV/EZrTiz7eGHC IvDHz2Mt8B4lJAsb8Du0ydss98mMXOl2l+tmfcDaVctZpqzP2pFhyRdcGtUY 7rWoDFWdzR;
- In-reply-to: <200807241425.m6OEPPhX015832@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <48888FDF.3030309@xxxxxxxxxxxx> <200807241425.m6OEPPhX015832@xxxxxxxxxxxxxx>
>>>>> "Peter" == Peter Stephenson <pws@xxxxxxx> writes:
Mike>> Is there a way to use bang notation to re-run a chunk of a
Mike>> shell's history? As an example I've got 4 commands
Mike>> numbered 123-126 in my history and I want to (in one swell
Mike>> foop) rerun all 4.
Peter> Not with bang notation, but you can use "r 123 126" to do
Peter> this.
I do the following almost everyday (with emacs binding), for example:
vi foo.c
gcc foo.c
a.out
vi <alt-p>
vi foo.c <ctrl-o>
gcc foo.c <ctrl-o>
a.out <ctrl-o> or <return>
After the a.out, I type: vi <alt-p> which binds to
history-beginning-search-backward which will bring 'vi foo.c' on the
command line. Then I type ctrl-o which binds to
accept-line-and-down-history to execute the 'vi foo.c' command and the
shell will bring up the next command in history 'gcc.foo.c', further
ctrl-o will continue walk the history.
If you replace foo.c with $i and put i=foo.c on top, you can then
repeat the commands by changing the file name, this is my perferred
way to edit lots of different files without writing a script first.
Lots of time this is simpler than using the history number. This is a
good old ksh trick and not sure how many people are using this.
-- Paul 07/24/08 09:43 AM --
Messages sorted by:
Reverse Date,
Date,
Thread,
Author