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

Re: What is distinct about exec of a builtin?



On Fri, Aug 31, 2018 at 2:13 AM, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> 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.



Messages sorted by: Reverse Date, Date, Thread, Author