rasen58
rasen58

Reputation: 5091

zsh: no matches found: [:space:]

For some reason, in zsh, I'm unable to use the [:space:] pattern to match all whitespace.

ex.

$ echo 'Welcome To Here' | tr [:space:] '\t'
zsh: no matches found: [:space:]

But if I do this in bash, then it works fine

$ echo 'Welcome To Here' | tr [:space:] '\t'
Welcome To  Here

Would this be some kind of problem in my ~/.zshrc, or does zsh not support this? I'm also using oh my zsh.

Upvotes: 3

Views: 9039

Answers (1)

Shawn
Shawn

Reputation: 52579

zsh sees the [:space:] and interpets it as a wildcard glob that will match a file named :, s, p, a, c or e. When there are no such files, it produces an error. So will bash with the failglob shell option enabled - your setup presumably turns it off somewhere. Just wrap it in quotes to prevent expansion:

echo 'Welcome To Here' | tr '[:space:]' '\t'

Upvotes: 6

Related Questions