zsh-workers
 help / color / mirror / code / Atom feed
* Re: Returning last parameter of a history command
       [not found] ` <200609221457.k8MEvAhC028569@news01.csr.com>
@ 2006-09-23 10:23   ` zzapper
  0 siblings, 0 replies; only message in thread
From: zzapper @ 2006-09-23 10:23 UTC (permalink / raw)
  To: zsh-workers; +Cc: zsh-users

Peter Stephenson <pws@csr.com> 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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-23 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Xns98469866682A5zzappergmailcom@80.91.229.5>
     [not found] ` <200609221457.k8MEvAhC028569@news01.csr.com>
2006-09-23 10:23   ` Returning last parameter of a history command zzapper

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).