Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Very useful !#^
- X-seq: zsh-users 11712
- From: "Seth Kurtzberg" <seth@xxxxxxx>
- To: <zsh-users@xxxxxxxxxx>
- Subject: RE: Very useful !#^
- Date: Fri, 3 Aug 2007 11:12:09 -0400
- In-reply-to: <Xns99819D6B98D4Czzappergmailcom@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9981863B7C3F4zzappergmailcom@xxxxxxxxxxx> <87wswc7qj9.fsf@xxxxxxxxxxxxxxxxxxx> <0f8801c7d5d3$656e4650$304ad2f0$@com> <Xns99819D6B98D4Czzappergmailcom@xxxxxxxxxxx>
- Thread-index: AcfV37HBlv0CmUM+Qp2JikRRW6Bw4gAAOhHA
Excellent summary, thanks much.
-----Original Message-----
From: news [mailto:news@xxxxxxxxxxxxx] On Behalf Of zzapper
Sent: Friday, August 03, 2007 10:29 AM
To: zsh-users@xxxxxxxxxx
Subject: RE: Very useful !#^
Seth
the # stands for current line
A summary :
# History Substitution Summary
#For CURRENT line that you are editing (the # designates current line)
# Remember Tab will expand the following
!#:0 current command
!#^ first parameter
!#:1 first parameter
!#:1-4 first 4 parameters
!#$ last parameter
!#* all parameters
!#$:s/bash/zsh perform substitution on previous parameter
cp longfilename.php backup_!#$
#For Previous Command (for comparison)
!-1 repeat whole command
!! repeat (shortcut)
!:0 command
!^ first parameter
!:1 first parameter
!:1-4 first 4 parameters
!$ last parameter
!* all parameters
!!:s/bash/zsh
For last but one command
!-2 repeat last but one command
!-2:2 second parameter of second but last command
etc
For history command 42
!42
<hr width=80%>
!:0 is the previous command name
!^, !:2, !:3, !$ are the arguments
!* is all the arguments
!-2, !-3, are earlier commands
!-2^, !-2:2, !-2$, !-2* are earlier parameters
# duplicate previous line (as example)
!:0 !^ !:2 !:3 !$ (of course you could do !!)
# duplicate nth previous line where n=1..n
!-n:0 !-n^ !-n:2 !-n:3 !-n$
cd !$:h (remove file name)
cat !!:t (only file name)
--
zzapper
http://successtheory.com/tips/zshtips.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author