[CentOS] perl one-liner issue

Benjamin Franz jfranz at freerun.com
Wed Mar 16 21:30:14 UTC 2011

On 03/16/2011 01:42 PM, Joseph L. Casale wrote:
>>> $conf['nagios_base'] =
>> I'd just search for that part, above.
> Me to, and I never even got to the replacement as the search for that
> was bailing:)

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.

Use 'echo' as a stand-in for Perl and you will see what is actually 
being passed to Perl for execution (it most likely isn't what you think 
it is). Once you know you are feeding Perl the right thing, you can 
worry about getting the pattern for the substitution correct.

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):


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

Benjamin Franz

More information about the CentOS mailing list