Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: time command with shell builtins
- X-seq: zsh-users 28811
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: dominik.vogt@xxxxxx, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: time command with shell builtins
- Date: Thu, 26 Jan 2023 08:56:34 -0800
- Archived-at: <https://zsh.org/users/28811>
- In-reply-to: <Y9Ko+7GqksX+LKww@localhost>
- List-id: <zsh-users.zsh.org>
- References: <Y86OR0DCpwfSYCXU@localhost> <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>
On Thu, Jan 26, 2023 at 8:23 AM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>
> Is there a more elegant way to chek if the command is in a
> blacklist than this one?
>
> if [[ -z "${1:|_zsh_recordtime_skip_list}" ]]; then
Alternate methods, judgement on elegance reserved:
if (( ${_zsh_recordtime_skip_list[(Ie)$1]} )); then
Or maintain _zsh_recordtime_skip_list as an associative array and
if (( ${+_zsh_recordtime_skip_list[$1]} )); then
In that case you could further use patterns as the keys of the array and do
if [[ -z ${_zsh_recordtime_skip_list[(k)$1]} ]]; then
or even use a zsh/db/gdbm ztie'd hash so that new items could be added
to the list and potentially shared among shells.
Note that ${+assocarray[(k)pat]} or [(I)pat] always returns 1 even
when no matching elements exist (that is, the result is empty string
rather than unset). I'm not sure whether that should be considered a
bug, but it's not explicitly documented.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author