Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Returning last parameter of a history command
- X-seq: zsh-users 10756
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Returning last parameter of a history command
- Date: Sat, 23 Sep 2006 10:23:50 +0000 (UTC)
- Cc: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns98469866682A5zzappergmailcom@xxxxxxxxxxx> <200609221457.k8MEvAhC028569@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Peter Stephenson <pws@xxxxxxx> wrote in news:200609221457.k8MEvAhC028569
@news01.csr.com:
> zzapper wrote:
>> Hi
>>
>> how should this done in zsh-speak
>>
>> history -n -1|sed 's/^.* //
>>
>> Where the sed returns the last parameter
>
> zmodload -i zsh/parameter
> print ${${(z)history[$((HISTCMD-1))]}[-1]}
>
Thanx PWS
I have adapted this to
print ${${(z)$(history -n -1)}[-1]}
so that I can use on a generic command
I was not able to tell if any of the 3 versions was faster
--
zzapper
A Mini-Internet Business for less than $5 that you can set up in less
than 5
minutes!!
http://www.twodollars.biz/?a=532036
Messages sorted by:
Reverse Date,
Date,
Thread,
Author