grep ‘–‘ (two dashes/hyphens) doesn’t work

grep ‘–‘ (two dashes/hyphens) doesn’t work

ls -a1 | grep ‘–‘
Usage: grep [OPTION]… PATTERN [FILE]…
Try ‘grep –help’ for more information.

Solution:

Source

Apparently ‘-X’ won’t worth either.

ls -a1 | grep -- '--' is the solution.

Leave a Reply

Your email address will not be published. Required fields are marked *