shell script question

Conor P. Cahill cpcahil at virtech.uucp
Sun Mar 4 23:38:27 AEST 1990


In article <652 at sagpd1.UUCP> jharkins at sagpd1.UUCP (Jim Harkins) writes:
>
>foreach i (list of files)
>	sed 's/foo/$i/' < $i > tmp
            ^^^^^^^^^^^
>	mv tmp $i
>end

The single quotes stop expansion of shell variables, hence the change to 
$i.  You should use something like

 	sed "s/foo/$i/" < $i > tmp
-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.questions mailing list