Another option, if you want to avoid local symlinks at all costs, is to use the default shell and make that decide which perl to run, using the uname command:
#!/bin/sh
if [ "$(uname)" = "Linux" ] ; then
perl="/nfs/linux/bin/perl"
else
perl="/nfs/aix/bin/perl"
fi
exec "$perl" /nfs/commom/perl/the-script.pl "$@"
You can merge this loader script and the perl code into a single script, see perlrun. This will look something like this:
#!/bin/sh
if [ "$(uname)" = "Linux" ] ; then
perl="/nfs/linux/bin/perl"
else
perl="/nfs/aix/bin/perl"
fi
exec "$perl" -x $0 "$@"
#!perl
# ^- "perl -x" searches for this line. Linux and AIX don't care about
+this line.
use strict;
use warnings;
print "Hello World!\n";
I don't know much about AIX. You may need to replace "$@" with ${1+"$@"}, see perlrun and http://www.in-ulm.de/~mascheck/various/bourne_args/. Also, uname and even test ([] may behave different than on linux.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
|