Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Very useful !#^
- X-seq: zsh-users 11710
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: RE: Very useful !#^
- Date: Fri, 3 Aug 2007 14:28:50 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns9981863B7C3F4zzappergmailcom@xxxxxxxxxxx> <87wswc7qj9.fsf@xxxxxxxxxxxxxxxxxxx> <0f8801c7d5d3$656e4650$304ad2f0$@com>
- Sender: news <news@xxxxxxxxxxxxx>
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