I have the following system variable in .zshrc
manuals='/usr/share/man/man<1-9>'
I run unsuccessfully
zgrep -c compinit $manuals/zsh*
I get
zsh: no matches found: /usr/share/man/man<1-9>/zsh*
The command should be the same as the following command which works
zgrep -c compinit /usr/share/man/man<1-9>/zsh*
How can you run the above command with a system variable in Zsh?
From my investigations, it looks like zsh performs
<>
substitution before$
substitution. That means when you use the$
variant, it first tries<>
substitution (nothing there) then$
substitution (which works), and you're left with the string containing the<>
characters.When you don't use
$manuals
, it first tries<>
substitution and it works. It's a matter of order. The final version below shows how to defer expansion so they happen at the same time:These can be seen here: