rm55+@andrew.cmu.edu (Rudolph T. Maceyko) (10/18/90)
Is it possible to make the same PERL script work on two machines that keep PERL in different places without having to manually include perl before each command execution? On machine A, PERL lives in /usr/contributed/bin. On machine B, it's in /usr/local/bin. I have access to the same file on both A and B, but have to specify "perl perl-script args" on machine B since the files begin with #!/usr/contributed/bin/perl. I can't use any kind of csh magic-number hack because (as I found out long ago) PERL mucks with the magic number. Suggestions? Or was this too confusing... Rudy +---------+ : +-----+ : Rudy Maceyko : : +-+ : : rm55+@andrew.cmu.edu : : : +-+ : rtmst@unix.cis.pitt.edu +-+ +-+-+-+
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (10/19/90)
In article <8b7GHJu00Vp6M3kosR@andrew.cmu.edu> rm55+@andrew.cmu.edu (Rudolph T. Maceyko) writes: > Is it possible to make the same PERL script work on two machines that > keep PERL in different places without having to manually include perl > before each command execution? No. You could try assuming that all (and I mean all) executables are accessible through /inst/bin, and setting up your machine accordingly. This will at least prepare you for a forthcoming package management system that makes the assumption come true. ---Dan
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (10/19/90)
In article <8b7GHJu00Vp6M3kosR@andrew.cmu.edu> rm55+@andrew.cmu.edu (Rudolph T. Maceyko) writes:
: Is it possible to make the same PERL script work on two machines that
: keep PERL in different places without having to manually include perl
: before each command execution?
Yes, but you have to use the following hack, or something similar
#!/bin/sh -- # perl
eval 'exec perl -S $0 ${1+"$@"}'
if 0;
Note that the exec depends on your PATH. The comment on the first line
tells perl not to start up /bin/sh, which would be counterproductive.
Larry
peter@dbaccess.com (Peter A. Castro) (10/20/90)
in article <8b7GHJu00Vp6M3kosR@andrew.cmu.edu>, rm55+@andrew.cmu.edu (Rudolph T. Maceyko) says:
+
+ Is it possible to make the same PERL script work on two machines that
+ keep PERL in different places without having to manually include perl
+ before each command execution?
+
+ On machine A, PERL lives in /usr/contributed/bin. On machine B, it's in
+ /usr/local/bin. I have access to the same file on both A and B, but
+ have to specify "perl perl-script args" on machine B since the files
+ begin with #!/usr/contributed/bin/perl. I can't use any kind of csh
+ magic-number hack because (as I found out long ago) PERL mucks with the
+ magic number.
+
+ Suggestions? Or was this too confusing...
A simple solution (depending on your point of view) would be to make a
directory /usr/contributed on machine B. Then link /usr/contributed
to /usr/local (hard or soft).
Also, the reverse trick could be done on machine A to be compatible with
scripts that have #!/usr/local/bin/perl in them.
Still another solution is to create a file link of /bin/perl or /usr/bin/perl
to their appropriate local directories. Then the scripts could be
standardized as such..
Just thoughts...
+
+ Rudy
+
+ +---------+
+ : +-----+ : Rudy Maceyko
+ : : +-+ : : rm55+@andrew.cmu.edu
+ : : : +-+ : rtmst@unix.cis.pitt.edu
+ +-+ +-+-+-+
--
Peter A. Castro INTERNET: peter@dbaccess.com // //|
c/o DB Access Inc. UUCP: {uunet,mips}!troi!peter // //||
2900 Gordon Avenue, Suite 101 FAX: (408) 735-0328 \\ // //-||-
Santa Clara, CA 95051-0718 TEL: (408) 735-7545 \// // ||