This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: grep will not work with a variable?


Kevin Markle wrote:
Keith Christian brought next idea :

Kevin Markle wrote:

Hello,

I'm trying to find a pattern in a file and the command works if I manully put the output of the variable in it but when I use the variable it fails? I have tryed with quotes "$CLIENT" and without. I don't know what else to try? :-(


echo "Client variable is --> \"${CLIENT}\"" ; grep "${CLIENT}" foo.txt

What does that tell you?

========Keith


I tryed adding a cd to the directory that I was attempting to grep from and that worked? This is okay because is worked but it would be nice to not have to so that...


Ok, suppose foo.txt is in /home/fflintstone/foo.txt, then:

echo "Client variable is --> \"${CLIENT}\"" ; grep "${CLIENT}" /home/fflintstone/foo.txt

=======Keith

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]