Handle hostnames with upper-case letters
[webmin.git] / perlpath.pl
1 #!/usr/local/bin/perl
2 # perlpath.pl
3 # This script gets run only from setup.sh in order to replace the 
4 # #!/usr/local/bin/perl line at the start of scripts with the real path to perl
5
6 $ppath = $ARGV[0];
7 if ($ARGV[1] eq "-") {
8         @files = <STDIN>;
9         chop(@files);
10         }
11 else {
12         # Get files from command line
13         @files = @ARGV[1..$#ARGV];
14         }
15
16 foreach $f (@files) {
17         open(IN, $f);
18         @lines = <IN>;
19         close(IN);
20         if ($lines[0] =~ /^#!\/\S*perl\S*(.*)/) {
21                 open(OUT, "> $f");
22                 print OUT "#!$ppath$1\n";
23                 for($i=1; $i<@lines; $i++) {
24                         print OUT $lines[$i];
25                         }
26                 close(OUT);
27                 }
28         }
29