3
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
5
# Copyright (C) 2005-2007 Foswiki Contributors.
6
# All Rights Reserved. Foswiki Contributors are listed in
7
# the AUTHORS file in the root of this distribution.
8
# NOTE: Please extend that file, not this notice.
10
# For licensing info read license.txt file in the TWiki root.
11
# This program is free software; you can redistribute it and/or
12
# modify it under the terms of the GNU General Public License
13
# as published by the Free Software Foundation; either version 2
14
# of the License, or (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details, published at
20
# http://www.gnu.org/copyleft/gpl.html
24
Change the "shebang" lines of all perl scripts found in the current
27
"shebang" lines tell the shell what interpreter to use for running
28
scripts. By default the TWiki bin scripts are set to user the
29
"/usr/bin/perl" interpreter, which is where perl lives on most
30
UNIX-like platforms. On some platforms you will need to change this line
31
to run a different interpreter e.g. "D:\indigoperl\bin\perl"
34
This script will change the "shebang" lines of all scripts found in
35
the directory where the script is run from.
37
Note: the path to the interpreter *must not* contain any spaces.
46
print "Enter path to interpreter [hit enter to choose '$new']: ";
54
print "Warning: I could not find an executable at $new
55
Are you sure you want to use this path (y/n)? ";
57
die "Aborted" unless $n =~ /^y/i;
62
opendir(D, ".") || die $!;
63
foreach my $file (grep { -f && /^\w+$/ } readdir D) {
66
open(F, "<$file") || die $!;
70
if( $contents =~ s/^#!\s*\S+/#!$new/s ) {
71
my $mode = (stat($file))[2];
72
chmod( oct(600), "$file");
73
open(F, ">$file") || die $!;
76
chmod( $mode, "$file");
77
print "$file modified\n";
80
print "$file modified\n";
84
print "$changed of $scanned files changed\n";