Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: time command with shell builtins
- X-seq: zsh-users 28892
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: time command with shell builtins
- Date: Thu, 2 Feb 2023 11:31:06 -0800
- Archived-at: <https://zsh.org/users/28892>
- In-reply-to: <Y9wLtMHvkyg3HU7K@localhost>
- List-id: <zsh-users.zsh.org>
- References: <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> <CAH+w=7avOPPgi-bJJBR-XjvUfapTcfDOhPJkMxFDHEOHPb63gw@mail.gmail.com> <Y9wLtMHvkyg3HU7K@localhost>
On Thu, Feb 2, 2023 at 11:15 AM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> In some scenarios with ctrl-c using psvar[2] for the
> raw time and the string to print resulted in error messages
> because the variable's value was just ' s'.
You could try using prompt conditionals to decide whether to prepend
the space/append the 's' so that $psvar[2] remains either a pure
number or nothing. Then you might not need psvar[3].
E.g. %2(v. %2vs..) in conjunction with
if (( $+commands[${CL[1]}] )); then
psvar[2]=()
and
if (( $psvar[2] <= $REPORTTIME )); then
psvar[2]=()
(this presumes you're not using psvar[4] and subsequent for other values)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author