Running C-Shell commands in perl 
Author Message
 Running C-Shell commands in perl

I Want to be able to specify in my perl script that all shell commands
are to be run in c-shell. it seems to be defaulting to Bourne.
Any ideas.


Sat, 25 Aug 2001 03:00:00 GMT  
 Running C-Shell commands in perl
I Want to be able to specify in my perl script that all shell commands
are to be run in c-shell. it seems to be defaulting to Bourne.
Any ideas.


Sat, 25 Aug 2001 03:00:00 GMT  
 Running C-Shell commands in perl
you'll probably want to look the %ENV hash and print out what it
currently sees as
its SHELL. Do something like print $ENV{SHELL}; then set it if its not
what you want
, with something like $ENV{SHELL} = "/bin/csh" .

--mark

Quote:

> I Want to be able to specify in my perl script that all shell commands
> are to be run in c-shell. it seems to be defaulting to Bourne.
> Any ideas.

--
E x p o N e t,  I n c. . . . full service web development

        Mark Cantrell, Programmer

        http://www.expo.net/



Sat, 25 Aug 2001 03:00:00 GMT  
 Running C-Shell commands in perl

John> I Want to be able to specify in my perl script that all shell
John> commands are to be run in c-shell. it seems to be defaulting to
John> Bourne.  Any ideas.

You really don't want to do that.  The Bourne shell can run
any command that the c-shell can run, and then some.

However, if you want a particular command to be executed by
the cshell, do this:

        system 'csh', '-fc', $your_command;

print "Just another Perl hacker,"

--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying

Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me



Sat, 25 Aug 2001 03:00:00 GMT  
 Running C-Shell commands in perl

Quote:

>you'll probably want to look the %ENV hash and print out what it
>currently sees as
>its SHELL. Do something like print $ENV{SHELL}; then set it if its not
>what you want
>, with something like $ENV{SHELL} = "/bin/csh" .

The contents of the SHELL environment variable do not affect they
interpreter that backticks, system(), exec(), and piped open()
run. They take after the the C functions system() and popen() in that
the always run the bourne shell. I've heard a couple of reasons for
this, none of them being contradictory:

1. It keeps programs running in the same fashion when moved from
machine to machine despite the shells installed on the system. There
was a time only BSD-ish systems had csh.

2. It keeps the programs running in the same fashion even when run
from different users despite the user's SHELL setting.. (Imagine, that
some peoples shell may be some sort of menu system that can't even
process a command line)

3. The poor redirection mechanisms of csh make it unsuitable for use.
--
Andrew Langmead



Sun, 26 Aug 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to run shell commands from Perl script?

2. running linux shell commands from perl scripts....

3. Beginners Problem - Running Shell commands in perl

4. How to run shell commands from Perl script?

5. Running c-shell commands in perl

6. How to run shell command from within perl?

7. running linux shell commands from perl scripts....

8. Beginners Problem - Running Shell commands in perl

9. Running shell commands via CGI script

10. Running shell commands via CGI script

11. Calling shell scripts or shell commands from Perl

12. HELP: Piping shell command into perl command?

 

 
Powered by phpBB® Forum Software