Running a perl script

OSB

OSB

Associate
Joined
26 Nov 2003
Posts
932
Location
UK
Hi all i'm in a spot of bother here, i'm trying to patch a program (nothing illegal) using some perl script. I'm actually on a mac atm so am trying to do it in terminal. Am i right in thinking the command i need to run is:

sudo sh -c "perl PATCH_SCRIPT < BACKUP > ORIGINAL"

Where the items in caps are the addresses of the items, eg:

PATCH_SCRIPT = /Users/OSB/Documents/patch.pl
BACKUP = /Users/OSB/Documents/theapplication
ORIGIONAL = /Applications/theapplication.app/Contents/MacOS/theapplication

The script is:
#!/usr/bin/perl

while($line=<STDIN>)
{
$line =~ s/\$GetListLen([^A-Za-z])/\$TEGListLen$1/g;
$line =~ s/\$ListLen([^A-Za-z])/\$SILtLen$1/g;
$line =~ s/\$MyNick([^A-Za-z])/\$NYMick$1/g;
$line =~ s/\$MaxedOut([^A-Za-z])/\$XAMedOut$1/g;
$line =~ s/\$Supports([^A-Za-z])/\$PUSports$1/g;
$line =~ s/\$FileLength([^A-Za-z])/\$LIFeLength$1/g;
$line =~ s/\$Get([^A-Za-z])/\$TEG$1/g;
$line =~ s/\$Send([^A-Za-z])/\$NESd$1/g;
$line =~ s/\$Canceled([^A-Za-z])/\$NACceled$1/g;
$line =~ s/\$Direction([^A-Za-z])/\$RIDection$1/g;
$line =~ s/\$GetZBlock([^A-Za-z])/\$TEGZBlock$1/g;
$line =~ s/\$UGetZBlock([^A-Za-z])/\$EGUtZBlock$1/g;
$line =~ s/\$UGetBlock([^A-Za-z])/\$EGUtBlock$1/g;
print $line;
}

Basically i don't know if its patched correctly and i don't know if this is therefore the reason the program won't run properly.


Thanks guys!
 
This isn't exactly Linux or Open source, but...

Is is not cd to the scrips location and then:
Code:
./patch.pl < BACKUP > ORIGINAL

No need to invoke perl yourself as the shebang is present.
 
Last edited:
Back
Top Bottom