Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: redirect STDOUT from system() function

by ChOas (Curate)
on Aug 10, 2001 at 12:24 UTC ( #103794=note: print w/ replies, xml ) Need Help??


in reply to redirect STDOUT from system() function

Hi!

How about using backticks:

#!/usr/bin/perl -w use strict; my @List=`ls -al`; print @List;
Would that do it for you ?

GreetZ!,
    ChOas

print "profeth still\n" if /bird|devil/;


Comment on Re: redirect STDOUT from system() function
Download Code
Replies are listed 'Best First'.
Re: Re: redirect STDOUT from system() function
by uzzikie (Sexton) on Aug 10, 2001 at 12:59 UTC
    hi

    nope i can't use backticks as the script is running setuid...
    says the $ENV{path} is insecur
    would be a bad idea anyway....
      Either way, Perl spawns a system call. You'll have to untaint a couple of things in %ENV. For example, this fails:
      #!/usr/bin/perl -wT use strict; # delete $ENV{qw( BASH_ENV PATH )}; my $output = `/bin/ls`; print "Output is ($output)\n";
      Uncommenting the appropriate line makes it work, at least on my box. Depending on what's tainted, you may have to do a little more work.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://103794]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2015-07-29 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls