Paul Eggert wrote: > This is for grep, which wants to warn about stray backslashes that > lead to unspecified behavior. For example, "grep -oi '\a'" > surprisingly is not equivalent to "grep -oi 'a'", so the stray > backslash should be warned about.
This warning punishes a traditional habit, namely to backslash-escape a leading ASCII '-' character, so as to avoid it from being interpreted as an option. Suppose I want to search for an ASCII arrow in some text: $ echo xy | ./grep '->' ./grep: invalid option -- '>' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. Decades ago, I was taught that the workaround is to add a backslash. This now produces $ echo xy | ./grep '\->' ./grep: warning: stray \ before - To avoid the warning, now I would have to write: $ echo xy | ./grep '[-]>' This is more cumbersome, because I have to insert two characters at different positions, rather than just one character. Bruno
