zsh

What's wrong with this glob pattern?


My interactive shell is zsh. In my home directory, I have the files

.zshrc .zshrc.mbook .sh_once .bashrc

and a few subdirectories, some of them also starting with a dot.

With the command

echo .*sh*c*[cke](.)

executed in my HOME, I expected to see the 4 aforementioned files, but it only returns .sh_once .zshrc.mbook. Why?


Solution

  • You are asking for filenames that contain a c and then end in c, k or e. The c in the middle and at the end cannot be the same. .zshrc and .bashrc have only the one c at the end, and therefore don't match.