zsh-users
 help / color / mirror / code / Atom feed
* store some parameters/arguments for later use
@ 2006-10-24 17:15 zzapper
  2006-10-25  0:36 ` Fernando Vezzosi
  0 siblings, 1 reply; 4+ messages in thread
From: zzapper @ 2006-10-24 17:15 UTC (permalink / raw)
  To: zsh-users

Hi
I'm sure Bart's told me about this b4 and I may have it somewhere

The ability to store some parameters/arguments for later use 

eg

> ls x1 x2 x3
save_parameters
...
...
...
vi recall_parameters


-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: store some parameters/arguments for later use
  2006-10-24 17:15 store some parameters/arguments for later use zzapper
@ 2006-10-25  0:36 ` Fernando Vezzosi
  2006-10-25 10:38   ` zzapper
  0 siblings, 1 reply; 4+ messages in thread
From: Fernando Vezzosi @ 2006-10-25  0:36 UTC (permalink / raw)
  To: zsh-users

Hi everyone!
I'm a happy lurker of zsh-*, now I figured I could even be helpful to
someone else :)

On Tue, Oct 24, 2006 at 05:15:42PM +0000, zzapper wrote:
> > ls x1 x2 x3
> save_parameters
> ...
> ...
> ...
> vi recall_parameters

If the `ls' command was command number, say, 15 in history, you would be
able to use its arguments later with:

!15:0 == "ls"
!15:1 == "x1"
!15:2 == "x2"
.. And so on

Note that you can do it also this other way:

!ls:0 == "ls" # very useful example :)
!ls:1 == "x1"
!ls:2 == "x2"
.. And so on

HTH, bye

-- 
  Fernando Vezzosi
	       3F29 4D20 510E E1AE 991D  3B12 D6BE 7C05 B289 97C9


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: store some parameters/arguments for later use
  2006-10-25  0:36 ` Fernando Vezzosi
@ 2006-10-25 10:38   ` zzapper
  2006-10-25 13:19     ` Chris Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: zzapper @ 2006-10-25 10:38 UTC (permalink / raw)
  To: zsh-users

Fernando Vezzosi <fvezzosi@masobit.net> wrote in news:20061025003630.GA1077
@lothlorien.passione:

> Hi everyone!
> I'm a happy lurker of zsh-*, now I figured I could even be helpful to
> someone else :)
> 
> On Tue, Oct 24, 2006 at 05:15:42PM +0000, zzapper wrote:
>> > ls x1 x2 x3
>> save_parameters
>> ...
>> ...
>> ...
>> vi recall_parameters
> 
Hi
What I've come up with is

spar () {
        P="$(history -n -1|sed 's/^[^ ]* //')"
}

and then anytime later I can say

vi $P


-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: store some parameters/arguments for later use
  2006-10-25 10:38   ` zzapper
@ 2006-10-25 13:19     ` Chris Johnson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Johnson @ 2006-10-25 13:19 UTC (permalink / raw)
  To: zsh-users

zzapper sent me the following 0.5K:

> >> > ls x1 x2 x3
> >> save_parameters
> >> ...
> >> ...
> >> ...
> >> vi recall_parameters
>  
> What I've come up with is
> 
> spar () {
>         P="$(history -n -1|sed 's/^[^ ]* //')"
> }
> 
> and then anytime later I can say
> 
> vi $P

If you want to save a process, you can try:

   $ echo a b c
   $ P="!:*"
   $ echo $P

There's probably an alias you could come up with to ease the assignment.
!:* grabs all but the first word from the previous command.

-- 
Chris Johnson
cjohnson@cs.utk.edu
http://www.cs.utk.edu/~cjohnson


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-10-25 13:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-24 17:15 store some parameters/arguments for later use zzapper
2006-10-25  0:36 ` Fernando Vezzosi
2006-10-25 10:38   ` zzapper
2006-10-25 13:19     ` Chris Johnson

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).