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

Re: time command with shell builtins



On Thu, Feb 2, 2023 at 10:10 AM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> Well, is there a way to detect inside preexec() wether a command
> is handled by the shell or some external binary?

If you actually have the command name, you can use
  if (( $+commands[$thename] ))

That won't work (or will be complicated) if the buffer that's about to
be executed is a complex structure (braces, subshell parens,
while/for/repeat/if/case/select/etc.).




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