zsh-workers
 help / color / mirror / code / Atom feed
* auto-exec on last command
@ 2011-08-21 21:33 Jörg Sommer
  2011-08-22  0:59 ` Bart Schaefer
  2011-08-28 15:54 ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: Jörg Sommer @ 2011-08-21 21:33 UTC (permalink / raw)
  To: zsh-workers

Hi,

is it possible to advice zsh to replace its process (with exec) with the
process of the last command? I have many processes running they only
spawn the desired program. It would be more efficent to run these
processes with exec to don't keep the intermediat process of the shell.
Something like zsh -c 'setopt execlast; $myprog' or zsh -Xc '$myprog'
that runs the script 'exec $myprog'.

Regards, Jörg.
-- 
Wer eher stirbt ist länger tot.
                                                        (Un B. Kant)


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

* Re: auto-exec on last command
  2011-08-21 21:33 auto-exec on last command Jörg Sommer
@ 2011-08-22  0:59 ` Bart Schaefer
  2011-08-22 21:33   ` Jörg Sommer
  2011-08-28 15:54 ` Peter Stephenson
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2011-08-22  0:59 UTC (permalink / raw)
  To: zsh-workers

On Aug 21,  9:33pm, Jorg Sommer wrote:
}
} is it possible to advice zsh to replace its process (with exec) with
} the process of the last command?

How is the shell supposed to know what command is the "last" one?

} Something like zsh -c 'setopt execlast; $myprog' or zsh -Xc '$myprog'
} that runs the script 'exec $myprog'.

I'm a bit puzzled.  If you know to set the option or pass the flag, why
can't you just use "zsh -c 'exec ...' ?


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

* Re: auto-exec on last command
  2011-08-22  0:59 ` Bart Schaefer
@ 2011-08-22 21:33   ` Jörg Sommer
  0 siblings, 0 replies; 4+ messages in thread
From: Jörg Sommer @ 2011-08-22 21:33 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Aug 21,  9:33pm, Jorg Sommer wrote:
>}
>} is it possible to advice zsh to replace its process (with exec) with
>} the process of the last command?
>
> How is the shell supposed to know what command is the "last" one?

Because the next token is EOF and no TRAPs are defined.

>} Something like zsh -c 'setopt execlast; $myprog' or zsh -Xc '$myprog'
>} that runs the script 'exec $myprog'.
>
> I'm a bit puzzled.  If you know to set the option or pass the flag, why
> can't you just use "zsh -c 'exec ...' ?

Take cron for example. Modifying the SHELL variable would be easy, but
changing all entries is much more work. Or the window manager IceWM. I
can configure the shell that's used to run subprocesses for menu entries,
but modifying all menu entries, and some of them are build by third party
scripts, is expensive.

Bye, Jörg.
-- 
Gienger's Law (http://www.bruhaha.de/laws.html):
Die Wichtigkeit eines Newspostings im Usenet ist reziprok zur Anzahl der
enthaltenenen, kumulierten Ausrufungszeichen.


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

* Re: auto-exec on last command
  2011-08-21 21:33 auto-exec on last command Jörg Sommer
  2011-08-22  0:59 ` Bart Schaefer
@ 2011-08-28 15:54 ` Peter Stephenson
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2011-08-28 15:54 UTC (permalink / raw)
  To: zsh-workers

On Sun, 21 Aug 2011 21:33:52 +0000 (UTC)
Jörg Sommer <joerg@alea.gnuu.de> wrote:
> is it possible to advice zsh to replace its process (with exec) with the
> process of the last command?

It does this automatically if it thinks the shell won't be needed again,
although there are probably complicated cases where it doesn't get this
right.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

end of thread, other threads:[~2011-08-28 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21 21:33 auto-exec on last command Jörg Sommer
2011-08-22  0:59 ` Bart Schaefer
2011-08-22 21:33   ` Jörg Sommer
2011-08-28 15:54 ` Peter Stephenson

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