[CentOS] perl one-liner issue

Joseph L. Casale jcasale at activenetwerx.com
Wed Mar 16 22:21:05 UTC 2011


>The problem is trying to pass valid Perl though the bash shell . There 
>is an insane amount of interaction between all the escapings involved in 
>this specific pattern. The hard problem is getting bash to *not* change 
>what you are passing to Perl before Perl sees it.

As I have noticed:)

>After enough poking and prodding you'll get something like this (after 
>giving up on getting bash to not molest the ' characters before passing 
>them to Perl):
>
>'s/(\$conf\[\047nagios_base\047]\s*=\s*")\/nagios\/cgi-bin";/$1stuffhere"\;/'

Yup, saw some notes like this, I ended up cheating with a couple of greedy
backreferences on both sides of the simple part of the match. Not exactly
error proof, but sufficient.

>Is there some reason you can't use a straight Perl script instead of 
>using bash to run a perl one liner?

Dunno, just always seen one liners in the %install section to fixup things
not adjustable by configure statements...

Thanks!
jlc



More information about the CentOS mailing list