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

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -