Re: [Hampshire] Am I correct

Top Page

Reply to this message
Author: Simon Reap
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Am I correct
Tim wrote:
> Secondly, where is the perl interpeter installed, is it /usr/lib/perl5
> or /usr/lib/perl I need to make a link from the interpeter to /usr/bin/perl
> or change the first line of a lot of scripts, I am opting to make the link
>

I would advise against making a symbolic link for perl - I have done
that, and perl couldn't find its modules. The symlink was from
/usr/local/bin/perl to /usr/bin/perl, so perl looked in /usr/local/lib
for modules, instead of /usr/lib.

Changing the header paths is very straightforward (assuming you are
using a sh-based shell). Use "which perl" to find out your default Perl
program (here it is given as /usr/bin/perl). If perl is not in your
path, then "whereis perl" (UNIX) or "locate perl" (Linux) should find it
- look for a line ending "/bin/perl".
"list_of_programs_with_the_wrong_Perl_path" could be something like
"/usr/local/bin/*.pl /usr/local/bin/startPerlPackage" (without the
quotes). Then:

    for ii in list_of_programs_with_the_wrong_Perl_path
    do
        sed '1s,^#![^[:space:]]*perl,#!/usr/bin/perl,' < $ii > 
/tmp/perl.tmp && mv /tmp/perl.tmp $ii
    done


There's probably a way to avoid the "mv" bit, but it's almost certainly
not portable between Linux/Unix/shell variants.

Simon