strange behaviour of grep in UNIX

Posted by Happy Mittal on Stack Overflow See other posts from Stack Overflow or by Happy Mittal
Published on 2010-04-16T11:12:46Z Indexed on 2010/04/16 11:43 UTC
Read the original article Hit count: 290

Filed under:
|

When I type a command
$ grep \\h junk
then shell should interpret \\h as \h as two pairs of \ become \ each,
and grep in turn, should interpret \h as \h as \ becomes \, so grep should
search for a pattern \h in junk, which it is doing successfully.

But it's not working for \\$. Please explain why ?

© Stack Overflow or respective owner

strange behaviour of grep in UNIX

Posted by Happy Mittal on Super User See other posts from Super User or by Happy Mittal
Published on 2010-04-16T11:12:46Z Indexed on 2010/04/16 13:43 UTC
Read the original article Hit count: 290

Filed under:
|

When I type a command
$ grep \\h junk
then shell should interpret \\h as \h as two pairs of \ become \ each,
and grep in turn, should interpret \h as \h as \ becomes \, so grep should
search for a pattern \h in junk, which it is doing successfully.

But it's not working for \\$. Please explain why ?

© Super User or respective owner

strange behaviour of grep in UNIX

Posted by Happy Mittal on Super User See other posts from Super User or by Happy Mittal
Published on 2010-04-16T11:28:17Z Indexed on 2010/04/16 11:34 UTC
Read the original article Hit count: 290

Filed under:
|

When I type a command
$ grep \h junk
then shell should interpret \h as \h as two pairs of \ become \ each,
and grep in turn, should interpret \h as \h as \ becomes \, so grep should
search for a pattern \h in junk, which it is doing successfully.

But it's not working for \$. Please explain why ?

© Super User or respective owner

Related posts about grep

Related posts about unix