On Thu, 7 Dec 2017 00:55:42 +0000 RW wrote: > Can anyone explain why '-' needs escaping in the following. What > special meaning does it have outside of []? > > $ echo 'a-b' | grep 'a-b' > a-b > > $ echo 'a-b' | grep '-b' > Usage: grep [OPTION]... PATTERN [FILE]... Never mind, the shell handles the quotes, so grep sees -b as an option rather than a pattern.