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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -