Question: Why should you always enclose your `grep` search pattern in single quotes? (e.g. `grep -v '?*' file` as opposed to `grep -v ?* file`) They
Why should you always enclose your `grep` search pattern in single quotes? (e.g. `grep -v '\?*' file` as opposed to `grep -v \?* file`)
| They are required by `grep`. | ||
| Some shell metacharacters are also regular expression characters, so `grep` could get confused when interpreting the command string. Quoting them makes `grep` ignore them and pass the literal characters to `bash`. | ||
| Some regular expression characters are also shell metacharacters and `bash` could get confused when interpreting the command string. Quoting them makes `bash` ignore them and pass the literal characters to `grep` | ||
| They are required by `bash`. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
