Re: Choosing the path based on the system "uname" command




Quoth "doni" <doni.sekar@xxxxxxxxx>:
Hi,

I want to write a program that does check the appropriate system path
for perl in FreeBSD and Linux.

The path where I have it in FreeBSD is
#! /usr/local/bin/perl

and the path where it is in Linux is
#! /usr/bin/perl

I wanted the program to check for the uname of the system and choose
the appropriate path. Can anyone tell me how can I have my program
check this.

This is not a Perl question. The path on the #! line is not used by
perl, but by your operating system. In general, there is no way to put
any logic into that line, though

#!/usr/bin/env perl

may do what you want. Note that it will use the perl in your current
PATH, which may be a security risk. As others have said, you are much
better off arranging for perl to be available as /usr/bin/perl, or
writing some sort of installation script that changes the #! line.

Ben

--
For far more marvellous is the truth than any artists of the past imagined!
Why do the poets of the present not speak of it? What men are poets who can
speak of Jupiter if he were like a man, but if he is an immense spinning
sphere of methane and ammonia must be silent? [Feynmann] ben@xxxxxxxxxxxx
.



Relevant Pages

  • UTF-8-codierte Umlaute via print und warn ausgeben
    ... Unter Windows/Cygwin im Cygwin-Terminal mit Cygwins Perl: ... Im UTF-8-Xterm funktioniert die Umlautausgabe mit print und warn, ... der zweite foo.pl-Aufruf unter Linux (und im ... Cygwin Perl (im xterm und im "gewoehnlichen" Cygwin-Terminal) und auch ...
    (de.comp.lang.perl.misc)
  • Re: sprintf rounding with FreeBSD and perl 5.8.x
    ... does not produce the result 0.0247, since 2.47 and .0247 aren't representable in finite binary digits: ... else I tried (ruby and python on Linux and FreeBSD). ... Linux, and that is the behavior I was trying to get. ... perl is compiled on FreeBSD? ...
    (comp.lang.perl.misc)
  • Re: LD_LIBRARY_PATH on x86_64 linux
    ... I imagine you also have to take in to account whether you are using 64bit OS vs 32 bit perl, etc. etc. I've always dealt with this issue on my Sun boxes and resorted to using a wrapper script. ... My environment generally needs to be different for launching other oracle applications, so this way I don't break other things. ... Subject: LD_LIBRARY_PATH on x86_64 linux ... on other Linux platforms, too. ...
    (perl.dbi.users)
  • Re: Demand of PF CLI
    ... >> using the PF APIs directly, or providing such access in perl, python, ... >> style approach was taken to embrace other firewall solutions. ... > you mean this module could work for Linux iptables too. ... There is Linux's iptables, ipf on NetBSD and Solaris, ...
    (comp.unix.bsd.openbsd.misc)
  • Re: Should fresh graduates be good at platform specific libraries?
    ... curious enough about linux to setup a linux box. ... unix-like shell environment and have not discovered perl. ... kind of stuff that says you will not be passionate about this career. ... real regular expressions in an Automata Theory course. ...
    (comp.programming)