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

Re: time command with shell builtins



On Tue, Jan 24, 2023 at 3:14 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> As far as I understand there's no reliable access to
> which command is being executed in preexec.

There's reliable access to what the user typed and to what that
expands to after alias replacement.  What else would you be looking
for?

preexec
     Executed just after a command has been read and is about to be
     executed.  If the history mechanism is active (regardless of
     whether the line was discarded from the history buffer), the string
     that the user typed is passed as the first argument, otherwise it
     is an empty string.  The actual command that will be executed
     (including expanded aliases) is passed in two different forms: the
     second argument is a single-line, size-limited version of the
     command (with things like function bodies elided); the third
     argument contains the full text that is being executed.




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