grep not expanding text strings containing variable refernces

grep not expanding text strings containing variable refernces

Post by robjunki » Wed, 26 Jul 2006 06:54:58


Hi,
Help- this is driving me mad
I basically want to read a text string from a config file which
contains variable references using grep from a (ksh) shell script, and
have it evaluated at run time. I can't find a way of making it
evaluate. E.g. (ignore typos and syntax errors- you get the idea).


file1.txt
Some text
more words ${testvariable}

file2.sh
#!/bin/ksh

testvariable=world
echo hello `grep more file1.txt|cut -d " " -f 3`

currently this evaluates as
hello ${testvariable}

instead of hello world

Help,
Cheers,
Rob.
 
 
 

grep not expanding text strings containing variable refernces

Post by Barry Marg » Wed, 26 Jul 2006 08:34:26

In article < XXXX@XXXXX.COM >,



eval echo hello `grep more file1.txt|cut -d " " -f 3`

--
Barry Margolin, XXXX@XXXXX.COM
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

 
 
 

grep not expanding text strings containing variable refernces

Post by robjunki » Wed, 26 Jul 2006 16:05:53


Many thanks
Rob