Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Returning last parameter of a history command



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