Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to use enviornemnt variables on the shebang line?

Status
Not open for further replies.

jimlocigno

Programmer
Nov 20, 2000
14
US
This may wind up being a long a question but let me try :)

1) Our shop currently has a mixed architecture 32-bit and 64-bit.
2) We use perl quite a bit. Because of the mixed architecture we have two perl installations (32-bit and 64-bit).
3) Currently all of perl scripts are shebanged with an older version of perl.
4) We want all our programmers to go over the 32-bit or 64-bit version of perl (and yes the path location has changed and MAY change again in a year or two).
5) Our analysts our "complaning" at changing the shebang line in a hard coded version. They are afraid the the perl locations may change again - this is actually possible -and somewhat out of our control.
6) What I would like is: I can determine the proper version of perl to use in the .profile. For clarity let's just say
Code:
PERLPATH=/perl58532/perl  or PERLPATH=/perl58564/perl
. What I would like the analyst to be able to do is put
Code:
#!$PERLPATH
as they shebang line. However, from what we have been able to tell this is not possible.
7) Is there any trick I can use to make the shebang line evaluate the environment variables.
8) Also to anticipate some questions:
- I know we could have a wrapper for a given perl script. However for various reasons this not a reasonable solution for us (suffice it to say we already have a wrapper scipt calling a wrapper script calling an (any script) ). The other reason is due to our scheudling software.
Also, I don't believe that making symoblics to perl would work. We have 160 nodes and the adminsistrators don't want to deal with that. In addition I don't belive that the solves the solution of using either the 585-32perl or 585-64perl.

Thanks.

I hope there is somekind of trick to use here but I think I have all ready exhausted all possibilties. Just thougth I would ask to be sure.
 

1) Create a link to perl under /usr/bin on all servers (for example:
Code:
cd /usr/bin
ln -s /perl58564/perl perl

2) Set the shebang line to this link:
Code:
#!/usr/bin/perl

And the scripts will be independent of the perl environment.
[3eyes]




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top