The command line is first processed by the shell. The result of an unquoted \-
will just be -
, and that is all that will be passed to grep
, which will treat it as an option flag. The double \\
or a quoted '\'
will result in a single \
being passed to grep
But, this is really the wrong way to indicate that "-5" is not a flag option. The right way is
grep -- -5 phone list
The "--" is the standard way to indicate that no more option arguments follow, and that nothing that follows should be treated as an option.