Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: time command with shell builtins
- X-seq: zsh-users 28889
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: dominik.vogt@xxxxxx, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: time command with shell builtins
- Date: Thu, 2 Feb 2023 10:28:36 -0800
- Archived-at: <https://zsh.org/users/28889>
- In-reply-to: <Y9v8kuT3/Qyzxtj7@localhost>
- List-id: <zsh-users.zsh.org>
- References: <CAN=4vMqSxEr-K1xg+fGc9kh2qfiZ31fy7hoDBRNHXXF6pH8eEg@mail.gmail.com> <Y86ZkYooJ9Kf4xCE@localhost> <CAHYJk3QD8NbCqt0LdXshiVf6W3GQLnDzo6-1mj0qCJOTkHFGRA@mail.gmail.com> <Y87Ws8PrZY8W3Oao@localhost> <CAHYJk3Tu5POCU08-g1dr2p284p89Xak5XjLSV6J8gWdQnOXDeA@mail.gmail.com> <Y8+3h5OXqtpkyewM@localhost> <Y9BlzD/hb4bwHAmb@localhost> <CAH+w=7Z3Srhc02WEmBv_m6YiGUm4mPw2oxNqfTAcm6kqm+GE=w@mail.gmail.com> <Y9B7A8dWLiZNXKfW@localhost> <Y9Ko+7GqksX+LKww@localhost> <Y9v8kuT3/Qyzxtj7@localhost>
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