Escape square brackets by default in zsh

Square brackets in zsh

Square brackets in zsh have special meanings but in MOST circumstances maybe you just have to escape them by putting \(backslash) before them.

Here is a example for generating a new octopress post

rake new_post["Escape square bracket by default in zsh"]
zsh: no matches found: new_post[Escape square bracket by default in zsh]

rake new_post\["Escape square bracket by default in zsh"\]
mkdir -p source/_posts
Creating new post: source/_posts/2012-07-08-escape-square-bracket-by-default-in-zsh.markdown

How to escape by default?

Just setup this alias in your .zshrc.

alias rake='noglob rake'
July 08, 2012 zsh, octopress


Qihuan Piao

Qihuan Piao

(aka kinopyo) is Chinese based in Tokyo. Software writer. He shares stories inspired him this blog. His infamous line - "I feel calm when I kill those monsters, or people (in game)" shocks his friends deeply.
He also writes in Japanese and Chinese.