- 论坛徽章:
- 0
|
回复 4# dn833
兄弟,我找到更全面的答案了,不过你的答案也是正确的,谢谢你!
stack overflow 上面的答案:http://stackoverflow.com/questio ... scape-while-not-for
Because the ] only has any special meaning when it has already been preceded by a [ that was not escaped.
You can have fun (if you've got the right, somewhat distorted, mindset) with:
grep '[][-]' ...
This searches for ], [ or -. You have to be careful with the placement of ]; it must go at the start of the character class. You have to be careful with the placement of -; it must go at the start or end of the class. And the caret that negates a class must go first.
grep '[^][-]' ...
|
|