Question about backquotes and linux echo

H

Hartin, Brian

Hi all,

I can't figure out why the following works from the command line but not
from the backquotes:

echo -e "a\nb\naa" | grep a

This should produce:

a
aa


However, when I execute:

puts `echo -e "a\\nb\\naa" | grep a`

I get:

-e "a\nb\naa"

Of course, this is a trivial example, but it represents my real problem
well enough. Writing the text to a temp file and using 'cat' isn't an
option, unfortunately.

Thanks for any help,

Brian Hartin
*************************************************************************=
***=20
This email may contain material confidential to
Pearson. If you were not an intended recipient,=20
please notify the sender and delete all copies.=20
We may monitor email to and from our network.=20
*************************************************************************=
***
 
H

Hartin, Brian

Nevermind...it was a Cygwin problem. Works fine on RedHat.


-----Original Message-----
From: Hartin, Brian=20
Sent: Wednesday, April 09, 2008 6:58 PM
To: '(e-mail address removed)'
Cc: Hartin, Brian
Subject: Question about backquotes and linux echo

Hi all,

I can't figure out why the following works from the command line but not
from the backquotes:

echo -e "a\nb\naa" | grep a

This should produce:

a
aa


However, when I execute:

puts `echo -e "a\\nb\\naa" | grep a`

I get:

-e "a\nb\naa"

Of course, this is a trivial example, but it represents my real problem
well enough. Writing the text to a temp file and using 'cat' isn't an
option, unfortunately.

Thanks for any help,

Brian Hartin
*************************************************************************=
***=20
This email may contain material confidential to
Pearson. If you were not an intended recipient,=20
please notify the sender and delete all copies.=20
We may monitor email to and from our network.=20
*************************************************************************=
***
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top