kilojoules kilojoules - 3 months ago 19
Bash Question

grep for the character string "--->"

How can I search for file containinng the character string

--->
?

$ cat arrow
--->
$ grep ---> *
-bash: *: ambiguous redirect
$ grep "--->" *
grep: unrecognized option '--->'
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help` for more information.
$ grep "\-\-\-\>" *
$

Answer

Use grep -- to signal end of options

grep -- '--->' *
Comments