What"s wrong with this line of code?

What"s wrong with this line of code?

am 10.05.2005 20:19:54 von JeffHowler

perl -pi -e 's/require\(\'includes\/application_top.php\'\);//g' *.php

Can anyone tell me why this expression won't work? I've been staring at it
too long. Thanks!

Re: What"s wrong with this line of code?

am 10.05.2005 20:40:06 von someone

JeffHowler wrote:
> perl -pi -e 's/require\(\'includes\/application_top.php\'\);//g' *.php
>
> Can anyone tell me why this expression won't work? I've been staring at it
> too long. Thanks!

The shell interprets the line before perl sees it so the escaped single quotes
won't work:

perl -pi -e"s/require\('includes\/application_top.php'\);//g" *.php


Or if you really need single quotes for -e'':

perl -pi -e's/require\('\''includes\/application_top.php'\''\);//g' *.php

Or:

perl -pi -e's/require\(\047includes\/application_top.php\047\);//g' *.php


John
--
use Perl;
program
fulfillment

Re: What"s wrong with this line of code?

am 10.05.2005 23:00:34 von JeffHowler

Thanks John, it worked perfectly! Very informative, too.


> The shell interprets the line before perl sees it so the escaped
> single quotes won't work:
>
> perl -pi -e"s/require\('includes\/application_top.php'\);//g" *.php
>
>
> Or if you really need single quotes for -e'':
>
> perl -pi -e's/require\('\''includes\/application_top.php'\''\);//g'
> *.php
>
> Or:
>
> perl -pi -e's/require\(\047includes\/application_top.php\047\);//g'
> *.php
>
>
> John