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

Re: time command with shell builtins



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