zshglobprezto

What does `(.N)` do in this extended glob?


The Prezto documentation has the following example script for setting up symlinks:

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

I understand everything in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N) up until (.N). What does (.N) mean here?

Bonus question, what is ${rcfile:t}? I understand that it resolves to the name of the rcfile but I don't know what the :t is for.


Solution

  • The bellow piece denies or negates (.N) all content wich starts '^' with README.md ^README.md(.N)

    The ^ symbol is a regular expression the means the beginning of something.

    The ${rcfile:t} part allows only the name stripping the dir name of string. Therefore the loop will create a needed symlink for each configuration file of your zpresto dir.