bash - Unexpected behavior of 'grep' -
can please explain behavior of grep below case:
$ grep <html> foo $ bash: html: no such file or directory
you need escape <
, >
inside bash.
- use backslash escape single character
- use single quotes escape multiple characters
correct syntax:
grep '<html>' myfile grep \<html\> myfile
further information:
<
, >
used i/o redirection. <
accepts input , >
redirects output. thus, grep <html> foo
tries read file named html
, redirects output file myfile
.
Comments
Post a Comment