Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: !!:$
- X-seq: zsh-users 8223
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: !!:$
- Date: Tue, 16 Nov 2004 16:03:31 -0800 (PST)
- In-reply-to: <20041116134539.GB14064@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041116134539.GB14064@xxxxxxxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Tue, 16 Nov 2004, keef wrote:
> something to the effect of:
> alias ch="chmod 755 !!:$"
This is what the "fc" command is for, by the way.
fcch() {
emulate -L zsh
# We're passed a file name, so:
# - read it
# - split it into shell words
# - and grab the last one
local w=${${(z)"$(<$1)"}[-1]}
# Write back the edited command
print "chmod 755 ${(qq)w}" >| $1
}
alias ch='fc -e fcch'
With that, you can even do e.g.
ch -3
to chmod the last argument from the third command back instead of the
immediately preceding command.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author