Perl : find perl executable binary


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl : find perl executable binary
# 1  
Old 12-24-2009
Perl : find perl executable binary

Hi

I have an oracle perl script running as cron job across multiple unix servers. The issue is the perl binary is found in multiple directories

I use in the start of the script ...
#!/usr/bin/perl

on some servers the script fails because /usr/bin/perl is not present. Is there a way i can specify couple of more binary locations like /sbin/perlsw/perl , /usr/perlsoft/perl in the start of the script? If /usr/bin/perl fails then look into the other 2 locations ...

Thanks
# 2  
Old 12-24-2009
Hi.

It's not possible to specify more than one shebang.

Perhaps you could try:

Code:
#!/usr/bin/env perl

# 3  
Old 12-24-2009
which means that in each of the servers, you know where the perl path is available, so in that case explicitly pass the perl script as an argument to perl command.

Have your script without the shebang line
detect the path of perl in a host
then path_to_perl <script_without_shebang_line>
# 4  
Old 12-25-2009
If you are going to have only this single script, then this solutions are ok.


But if you wanted to have multiple other scripts in the near future, and execute in various servers, then try creating links for the executables in a specific dir in all servers, and then use that.
# 5  
Old 12-25-2009
Quote:
Originally Posted by scottn
Hi.

It's not possible to specify more than one shebang.

Perhaps you could try:

Code:
#!/usr/bin/env perl

Hello what if env is not in /usr/bin/env .
just kidding.
Merry Christmas.

---------- Post updated at 10:50 PM ---------- Previous update was at 10:48 PM ----------

Hello
you can give your cron job as "perl name_of_script".
This will call perl wherever it is (of course in $PATH). and would override the shebang line.
Hope this helps.
Regards.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Binary patch using perl

for all who are interested: a bash function scanning all unique strings in FILE that contain a token and replacing it. Furthermore the function demonstrates how to construct a perl command from variables in a script: patchfile() { local -r file="$1" local -r... (1 Reply)
Discussion started by: dodona
1 Replies

2. Shell Programming and Scripting

Get the File name of perl executable in Linux

Hi All, I just want to know how to get the executable name of the perl script as i know "$0" will give me the script name but i want to know the executable name which i got it from the script using pp command. Regards Raj (1 Reply)
Discussion started by: kar_333
1 Replies

3. Shell Programming and Scripting

Making a perl script executable

Hello, I have a perl program called snp_hwe.pl I have another program called hwe_test.run which contains the following: for file in *.inp do cp $file genotype_counts_c.txt ./snp_hwe.exe > $file'.res' done I want to change my perl program to an executable program while changing... (3 Replies)
Discussion started by: Homa
3 Replies

4. Shell Programming and Scripting

perl script to open an executable and pass the user credentials

Is it possible to open an executable file and pass user credentials through the perl script. If yes Please do share the CPAN module names and the way to access the executable file. For eg. I want to open the IBM LOTUS Sametime through my perl code and pass the user credentials like... (1 Reply)
Discussion started by: giridhar276
1 Replies

5. Shell Programming and Scripting

Displaying a number in binary using perl

printf FH2" 3'b%b : begin\n",$i; where i is an integer in the loop is displaying 3'b1 : begin expected output was 3'b001 : begin (1 Reply)
Discussion started by: dll_fpga
1 Replies

6. Shell Programming and Scripting

Convert binary to text Perl script

Hello everyone, I have a binary file with a structure unknown. I have found 2 perl scripts that it seems to do the convertion but I get sintactic errors when I run them, may somebody test these 2 scripts please and see if really work? One if from here... (10 Replies)
Discussion started by: Ophiuchus
10 Replies

7. Shell Programming and Scripting

capturing C++ binary return status in perl

Hello, I have a C++ binary that runs in my perl script. But, Currently, the binary is doing a core dump and i want to capture the retrun status of the binary to report as an issue. Can you please help me on this. Thanks, Sateesh (1 Reply)
Discussion started by: kotasateesh
1 Replies

8. Shell Programming and Scripting

capturing C++ binary return status in perl

Hello, I have a C++ binary that runs in my perl script. But, Currently, the binary is doing a core dump and i want to capture the retrun status of the binary to report as an issue. Can you please help me on this. Thanks, Sateesh (1 Reply)
Discussion started by: kotasateesh
1 Replies

9. Shell Programming and Scripting

calling a C executable from inside a Perl script

here's the Perl code snippet... how can i call my C executable 'porter-stemmer' and pass it $1 as an argument? Thanks for the help! # Read through the original topic set, and modify based on the current # pre-processing options while (<TOPIC_ORIG>) { # Run pre-processing over only the... (3 Replies)
Discussion started by: mark_nsx
3 Replies

10. Shell Programming and Scripting

Perl and binary workings

Perhaps it's me - maybe I'm dumb and am getting this working solution wrong... I have a binary value 00000011 in $binVal and I want to print the result in denary, so in perl I did as the perldoc -f oct told me to do and added a 0b prefix as so: $binVal = "0b" . $binVal; then I wanted to... (5 Replies)
Discussion started by: WIntellect
5 Replies
Login or Register to Ask a Question