这段 zsh 代码如何记录时间?似乎没有日期或任何东西

How does this snippet of zsh code keep track of time? Doesn't seem to have date or anything

我在 prezto 存储库中看到了这段代码,我真的很困惑。

似乎每 20 小时重建一次 zsh comp,但我不知道如何。

(Nm-20) 似乎是调用子 shell,但 Nm-20 本身不是程序。

($BLAH/zcompdump)应该是一个文件,但不应该是可执行文件,为什么要用()围起来呢?

最后,if (( $#_comp_files ))好像是外层()是测试( $#_comp_files )是否正确,但是$#_comp_files是什么?

# Load and initialize the completion system ignoring insecure directories with a
# cache time of 20 hours, so it should almost always regenerate the first time a
# shell is opened each day.
autoload -Uz compinit
_comp_files=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20))
if (( $#_comp_files )); then
  compinit -i -C
else
  compinit -i
fi
unset _comp_files

神奇的是 Glob 限定符的使用。
在文件名的末尾,您可以添加带有过滤器的括号。

.zcompdump(Nm-20)) 将 select 只有在不到 20 天前修改过的文件。
N 表示不显示错误 (NULL_GLOB)。

缺少 h 才能 Nmh-20 如果在不到 20 小时前修改过它。

man zshexpn 然后搜索 Glob 限定符。

自己尝试

cd /tmp
touch myfile
z=(myfile(Nmm-1)) ; echo $z

等一下再试最后一行,有或没有 N