tags:

views:

57

answers:

1

hi I have the following script that replace a param to b param and match only the c parameter in line how to change the perl syntax: if /$c/ in order to export c param to the follwoing perl syntax

#!/bin/bash
export a='@d&' 
export b='new text' 
export c='bla bla'
echo $LINE |  perl -pe 'next if /^#/; s/(^|\s)\Q$ENV{a}\E(\s|$)/$1$ENV{b}$2/ if /$c/' 

example of line

parameter=@d&

when c is the parameter

+2  A: 

what you need is

if /$ENV{c}/

And please format your code properly

dsm