Perl Interpreter Default Shell


 
Thread Tools Search this Thread
Operating Systems Solaris Perl Interpreter Default Shell
# 1  
Old 11-06-2013
Perl Interpreter Default Shell

Hello. We have recently changed from HP Unix Servers to Solaris. On the HP Severs we were using the POSIX shell. Solaris is using the Bourne sh.

We are using ksh as our default shell after login. The problem we are encountering is when something like Perl or Cron uses the shell to execute a command it is using bin/sh.

We have some perl scripts that run shell scripts inside of them. They are not working as they were designed for POSIX/KSH.

Is there anyway to make perl use a different shell when invoking shell scripting?
# 2  
Old 11-06-2013
Those scripts ought to have the shell they need in their hashbang line.
# 3  
Old 11-06-2013
I will explain further....It's not calling a script.. Here is a line of code in the pearl script:

`sf_write_to_log`;

sf_write_to_log is a script located in another location that is set by the $PATH variable. sh for some reason doesn't use the $PATH and can't find the function.

I can test this by trying these commands at the command line:

> sh sf_write_to_log
sf_write_to_log: sf_write_to_log: cannot open

> ksh sf_write_to_log
working
# 4  
Old 11-06-2013
Cron does not normally run jobs within your normal environment. Try invoking the perl scripts through /usr/bin/env. That should pull the environment you normally have at the command prompt into the cron environment for that script.
E.g. if you have this in your crontab:
Code:
30 2 * * * /home/apm/cron/mycron.pl

try instead:
Code:
30 2 * * * /usr/bin/env /home/apm/cron/mycron.pl

You can then set $HOME, $PATH, $SHELL and anything else you need in your .profile

Andrew
# 5  
Old 11-06-2013
I tried running
Code:
/usr/bin/env my_script.pl

same error. It's still not getting the $PATH

Last edited by Franklin52; 11-07-2013 at 04:20 AM.. Reason: Please use code tags
# 6  
Old 11-15-2013
I think the problem is that our default shell is set to KSH and our $PATH is being set there. But perl is running any inline commands using SH. SH doesn't have the $PATH.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell BASIC interpreter(s)...

I am looking for a simple BASIC Interpreter written in a shell scripting language. For me something like this would be a great learning tool... After much goggle eyed Googling I came upon this:- https://gist.github.com/cander/2785819 It is small and I haven't tried it yet as I am at work... (6 Replies)
Discussion started by: wisecracker
6 Replies

2. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

3. Shell Programming and Scripting

Perl - bad interpreter: No such file or directory

Here is a puzzler. To start, let me say that I've done a search on this issue and it is definitely not related to line endings being encoded in windows returns. I get this error when I run SOME perl scripts. I have a script called hello_world.pl. I do $cp hello_world.pl new_hello_world.pl... (0 Replies)
Discussion started by: mjmtaiwan
0 Replies

4. Infrastructure Monitoring

HPUX net-SNMP interpreter "/bin/perl" not found

I am trying to install net-snmp on an HPUX box. I am getting the fallowing error message when I try to run the snmpconf file. I installed the fallowing version of net-snmp net-snmp-5.0.10.2-HP-UX_B.11.11_9000_800.tar and my HPUX box is version HP-UX commnms B.11.11 U 9000/800... (2 Replies)
Discussion started by: krisarmstrong
2 Replies

5. Shell Programming and Scripting

Test for shell interpreter at beginning of script

What would be the best way or method to determine or test for the shell interpreter at the beginning of a script in the event one shell is not available? If I use the following: #!/bin/bash and /bin/bash is not available, then use I'd like to use /bin/ksh if it is available. #!/bin/ksh (8 Replies)
Discussion started by: nck
8 Replies

6. UNIX for Dummies Questions & Answers

Shell and commandline interpreter-definitions

What is the difference between the(a) shell and the (a) command-line interpreter? Here we're talking about the complete dummy question, but could someone point me right. (yes, have written scripts in for instance bash shell, and and grepp-ed my way around ....:eek: (4 Replies)
Discussion started by: amkgw
4 Replies

7. Windows & DOS: Issues & Discussions

rediretion and pipes in DOS shell cmd interpreter

Hello, I am trying to accomplish the following. Send the output of a command to the screen (this happens by default) as well as capture the output of the screen to a log file. How can this be achieved in DOS command interpreter syntax. Any ideas/suggesstions/indicators are greatly... (2 Replies)
Discussion started by: jerardfjay
2 Replies
Login or Register to Ask a Question