zsh-users
 help / color / mirror / code / Atom feed
* What is distinct about exec of a builtin?
@ 2018-08-31  9:13 Sebastian Gniazdowski
  2018-08-31 22:42 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2018-08-31  9:13 UTC (permalink / raw)
  To: Zsh Users

Hello,
reading the source I've noted that one can exec builtin. Tested `exec
type -w run-help`, it worked and shell quickly exited. I wonder what
can this functionality be used for? Is there anything distinct about
exec'ing a builtin?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org


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

* Re: What is distinct about exec of a builtin?
  2018-08-31  9:13 What is distinct about exec of a builtin? Sebastian Gniazdowski
@ 2018-08-31 22:42 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2018-08-31 22:42 UTC (permalink / raw)
  To: Zsh Users

On Fri, Aug 31, 2018 at 2:13 AM, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
> reading the source I've noted that one can exec builtin. Tested `exec
> type -w run-help`, it worked and shell quickly exited. I wonder what
> can this functionality be used for? Is there anything distinct about
> exec'ing a builtin?

There's nothing magic about this (although ISTR it was changed to work
differently / not at all when POSIX_BUILTINS, fairly recently).

Using "exec" just means that the shell will exit once the builtin has
completed.  It's there so that if you exec something you think is an
external command but it turns out to have been supplanted by a
builtin, the shell will still behave as if something external had been
execve()'d.


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

end of thread, other threads:[~2018-08-31 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-31  9:13 What is distinct about exec of a builtin? Sebastian Gniazdowski
2018-08-31 22:42 ` Bart Schaefer

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